var paywin = null;
var payurl = "https://payonline.ecu.edu.au/integrated/tranadd?TRAN-TYPE=830-1&Description=\"Mobile Phone Repayment $EXBILLPERIOD\"&BillPeriod=\"$EXBILLPERIOD\"&StaffNumber=$EMPID&Phone=$MOBILE&UnitAmountIncTax=$AMOUNT&GLCode=$GLCODE&EMAIL=$EMAIL";
function paylink()
{
var outp = "";
outp += '
';
return outp;
}
function popprintwin()
{
// show only pu calls and total
tick_show_wr_only.checked = false;
tick_show_pu_only.checked = true;
show_pu_wr();
if ( ynConfirm("Print a Copy?") )
window.print();
}
function popCashierPaymentwin()
{
// show only pu calls and total
tick_show_wr_only.checked = false;
tick_show_pu_only.checked = true;
show_pu_wr();
// additional GST removed 27/03/2013
//var gstcost = 10 * pu_wr_totalcost / 100;
var gstcost = 0;
var totalpayable = strcost(pu_wr_totalcost + gstcost);
//totalpayable = Math.round(totalpayable * 100) / 100;
//var glcode = centre + "." + project;
var grname1 = getCookie("WB_grname1");
var glcode = "NOT FOUND";
if ( grname1 == null || grname1 == "" ) {
grname1 = "NOT FOUND";
alert("GLCODE cannot be found for UserID: " + this_userid);
return;
}
else {
glcode = grname1.substr(0,5) + "." + grname1.substr(6,4) + "." + "1614" + "." + grname1.substr(16,2) + "." + grname1.substr(19,2) + "." + "01";
}
//alert("grname1=[" + grname1 + "]\n" + "glcode=[" + glcode + "]");
if ( !ynConfirm("Cashier Payment?") ) {
return;
}
var cashpayurl = '../wbt_cashpay.cgi'
+ '?' + 'servicetypeid="' + this_servicetypeid + '"'
+ '&' + 'this_userid="' + this_userid + '"'
+ '&' + 'centre="' + centre + '"'
+ '&' + 'centredesc="' + centredesc + '"'
+ '&' + 'name="' + name + '"'
+ '&' + 'mobile="' + mobile + '"'
+ '&' + 'glcode="' + glcode + '"'
+ '&' + 'exbillperiod="' + exbillperiod + '"'
+ '&' + 'totalpayable="' + totalpayable + '"'
var enccashpayurl = encodeURI(cashpayurl);
paywin = window.open(enccashpayurl,'','resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=no,status=yes,directories=no,top=0,left=0,height=550,width=950');
}
function poppaywin()
{
// show only pu calls and total
tick_show_wr_only.checked = false;
tick_show_pu_only.checked = true;
show_pu_wr();
// additional GST removed 27/03/2013
//var gstcost = 10 * pu_wr_totalcost / 100;
var gstcost = 0;
var totalpayable = strcost(pu_wr_totalcost + gstcost);
//totalpayable = Math.round(totalpayable * 100) / 100;
var email = getCookie("WB_email");
//var glcode = centre + "." + project;
var grname1 = getCookie("WB_grname1");
var glcode = "NOT FOUND";
if ( grname1 == null || grname1 == "" ) {
grname1 = "NOT FOUND";
alert("GLCODE cannot be found for UserID: " + this_userid);
return;
}
else {
glcode = grname1.substr(0,5) + "." + grname1.substr(6,4) + "." + "1614" + "." + grname1.substr(16,2) + "." + grname1.substr(19,2) + "." + "01";
}
//alert("grname1=[" + grname1 + "]\n" + "glcode=[" + glcode + "]");
if ( !ynConfirm("Open Pay Site?") ) {
return
}
if ( !popconfirmreviewwin() ) {
return
}
var fullpayurl = payurl;
fullpayurl = fullpayurl.replace(/\$EXBILLPERIOD/g,exbillperiod);
fullpayurl = fullpayurl.replace(/\$NAME/g,name);
fullpayurl = fullpayurl.replace(/\$EMAIL/g,email);
fullpayurl = fullpayurl.replace(/\$EMPID/g,this_userid);
fullpayurl = fullpayurl.replace(/\$MOBILE/g,mobile);
fullpayurl = fullpayurl.replace(/\$AMOUNT/g,totalpayable);
fullpayurl = fullpayurl.replace(/\$GLCODE/g,glcode);
var encfullpayurl = encodeURI(fullpayurl);
//alert("\n" + "fullpayurl=[" + fullpayurl + "]\n\n" + "encfullpayurl=[" + encfullpayurl + "]");
paywin = window.open(encfullpayurl,'','resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=no,status=yes,directories=no,top=0,left=0,height=550,width=950');
}
function confirm_no_pu()
{
// show only pu calls and total
tick_show_wr_only.checked = false;
tick_show_pu_only.checked = true;
show_pu_wr();
if ( ynConfirm("Please confirm that there isn't any non-business charges in this bill?") ) {
set_pu_reviewed(0);
alert("No personal usage confirmed.");
}
}
function popconfirmreviewwin()
{
// show only pu calls and total
tick_show_wr_only.checked = false;
tick_show_pu_only.checked = true;
show_pu_wr();
var grname1 = getCookie("WB_grname1");
var glcode = "NOT FOUND";
if ( grname1 == null || grname1 == "" ) {
grname1 = "NOT FOUND";
alert("GLCODE cannot be found for UserID: " + this_userid);
return;
}
else {
glcode = grname1.substr(0,5) + "." + grname1.substr(6,4) + "." + "1614" + "." + grname1.substr(16,2) + "." + grname1.substr(19,2) + "." + "01";
}
if ( ynConfirm("Please Confirm you have identified all non-business charges in this bill?") ) {
set_pu_reviewed(pu_wr_totalcost);
alert("Review Confirmed.");
return true;
}
return false;
}
function set_pu_reviewed(pu_wr_totalcost)
{
var now = new Date;
var dd = now.getDate();
var dd = ((dd < 10) ? "0" : "") + dd;
var mm = now.getMonth() + 1;
var mm = ((mm < 10) ? "0" : "") + mm;
var yyyy = now.getFullYear();
var ddmmyyyy = dd + "-" + mm + "-" + yyyy;
pu_reviewed_date = ddmmyyyy;
var accntprocfee = 0 // 0.05 * XTOTAL
var usertotal = XTOTAL + accntprocfee
//var gstcost = 10 * pu_wr_totalcost / 100;
var gstcost = 0;
var totalpayable = strcost(pu_wr_totalcost + gstcost);
var grname1 = getCookie("WB_grname1");
var glcode = "NOT FOUND";
if ( grname1 == null || grname1 == "" ) {
grname1 = "NOT FOUND";
}
else {
glcode = grname1.substr(0,5) + "." + grname1.substr(6,4) + "." + "1614" + "." + grname1.substr(16,2) + "." + grname1.substr(19,2) + "." + "01";
}
pu_reviewed_amount = strcost(totalpayable);
wr_reviewed_amount = strcost(usertotal - pu_wr_totalcost);
mobilebill_save_userData();
// confirmation - send email notification
var url = '../wbt_confirmmobilereview.cgi'
+ '?' + 'servicetypeid="' + this_servicetypeid + '"'
+ '&' + 'this_userid="' + this_userid + '"'
+ '&' + 'centre="' + centre + '"'
+ '&' + 'centredesc="' + centredesc + '"'
+ '&' + 'name="' + name + '"'
+ '&' + 'mobile="' + mobile + '"'
+ '&' + 'glcode="' + glcode + '"'
+ '&' + 'exbillperiod="' + exbillperiod + '"'
+ '&' + 'totalpayable="' + totalpayable + '"'
var encurl = encodeURI(url);
var result = getFile(encurl, '', "POST", null, null);
if ( result.indexOf("Review confirmation received.") < 0 ) {
alert("Error: url=[" + url + "]\n" + "result=" + result);
}
}
function strcost(val)
{
var f = 0;
var isneg = 0;
if (val != null && val != "")
f = parseFloat(val);
if ( f < 0 ) {
isneg = 1
f = f * -1
}
var dollars = Math.floor(f);
var cents = Math.round((f * 100) % 100);
if ( cents == 100 ) {
dollars += 1;
cents = 0;
}
if ( dollars == 0 && cents == 0 )
return "0.00"
var dollars_str = dollars
var str = (isneg ? "-" : "") + "" + dollars_str + ".";
if ( cents < 10 )
str = str + "0" + cents;
else
str = str + cents;
return str;
}