$companyId = $mi_company_info['userId']; $msg = $invoiceDetails['mi_title']; } $forcomp = "Invoice " . $forcomp; } else { if ($_REQUEST['focus'] == 'payDay' && $_REQUEST['thisdate'] > 0) { $nextPayDay = strtotime(pushBackOnePeriod()); $mi_pay_info = calcReal(intval($_REQUEST['thisdate'])); $date = date("F j, Y", $_REQUEST['thisdate']); $msg = "Projected Payday"; $forcomp = $msg . " " . $forcomp; $msg .= " for {$date}"; } else { if ($_REQUEST['focus'] == 'projSet' && $_REQUEST['thisdate'] > 0) { $last_pay_info = calcReal($_REQUEST['thisdate'] - $companyInfo['cd_payperiod'] * (60 * 60 * 24)); $mi_pay_info = calcReal($_REQUEST['thisdate']); $mi_pay_info['NewBalance'] = $mi_pay_info['ProjectedSales'] - $last_pay_info['ProjectedSales']; $mi_pay_info['Rollover'] = $last_pay_info['ProjectedSales']; $mi_pay_info['Balance'] = 0; $date = date("F j, Y", $_REQUEST['thisdate']); $mi_company_info = $companyInfo; $msg = "Projected Balance Estimate"; $forcomp = $msg . " " . $forcomp; $msg .= " for {$date}"; } else { $forcomp = "Information " . $forcomp; } } } // List Reports ob_start();
} } $sql = "select * from `cs_merchant_invoice` where mi_company_id = '{$companyId}' ORDER BY `mi_paydate` ASC"; $result = mysql_query($sql) or dieLog(mysql_error() . " ~ {$sql}"); while ($InvoiceDetails = mysql_fetch_assoc($result)) { $paydate = strtotime($InvoiceDetails['mi_paydate']); $mi_pay_info[intval(date('ymd', $paydate))] = unserialize($InvoiceDetails['mi_pay_info']); $mi_pay_info[intval(date('ymd', $paydate))]['mi_ID'] = $InvoiceDetails['mi_ID']; } $date_hold = 0; $date_delay = 0; $nextPayDay = strtotime($companyInfo['cd_next_pay_day']); if ($mi_pay_info[intval(date('ymd', $nextPayDay))]) { $nextPayDay = strtotime(pushBackOnePeriod()); } $projPayDay[intval(date('ymd', $nextPayDay))] = calcReal($nextPayDay); ?> <table border="0" cellpadding="0" width="100%" cellspacing="0" > <tr> <td width="90%" valign="top" align="center" > <br> <form action="projectedsettlement.php" method="GET" name="FrmMerchant" > <table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="22" align="left" valign="top" width="1%" background="images/menucenterbg.gif" nowrap><img border="0" src="images/menutopleft.gif" width="8" height="22"></td> <td height="22" align="center" valign="middle" width="50%" background="images/menucenterbg.gif" ><span class="whitehd">View Projected Settlement <?php echo $forcomp; ?> </span></td> <td height="22" align="left" valign="top" width="3%" nowrap><img border="0" src="images/menutopcurve.gif" width="49" height="22"></td> <td height="22" align="left" valign="top" width="45%" background="images/menutoprightbg.gif" ><img alt="" src="images/spacer.gif" width="1" height="1"></td>
//sleep(1); $quick_status = get_merchant_quick_status($companyInfo['userId']); while (pastPayPeriod() && $error < 1000) { $pushedBack = pushBackOnePeriod(); $sql = "Update cs_companydetails set `cd_next_pay_day` = '{$pushedBack}' where userId = '" . $companyInfo['userId'] . "'"; $companyInfo['cd_next_pay_day'] = $pushedBack; $error++; if ($error == 1000) { print "Error " . $companyInfo['userId'] . "<BR>"; } } if ($sql) { sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}"); } $date_hold = 0; $mi_pay_info = calcReal(strtotime($companyInfo['cd_next_pay_day'])); $pay_checked = ''; if ($mi_pay_info['Status'] == 'Payable' && $quick_status['actual'] > 0) { $pay_checked = 'checked'; $est_payable += $mi_pay_info['Balance']; } $est_total += $mi_pay_info['Balance']; //if($show_rollover=='s' && $mi_pay_info['Status']!='Rollover') continue; //if($show_rollover=='p' && $mi_pay_info['Status']!='Payable') continue; ?> <tr> <td class="info"><a href="editCompanyProfileAccess.php?company_id=<?php echo $companyInfo['userId']; ?> "><?php echo substr($companyInfo['companyname'], 0, 20);
function updateCompanyPayStatus() { return 0; global $companyInfo; $time = microtime_float(); $log = "Running a search for all live companys for Bank #{$bankId}\n"; $company_list_sql = "Select cd.* from `cs_companydetails` as cd left join `cs_transactiondetails` as t on t.userId = cd.userId WHERE transactionId is not NULL group by companyname"; $result = mysql_query($company_list_sql) or dieLog(mysql_error() . " ~ {$company_list_sql}"); while ($companyInfo = mysql_fetch_assoc($result)) { $mi_pay_info = calcReal(time() + 600000); $cd_pay_status = 'unpayable'; $balance = $mi_pay_info['Gross'] - $mi_pay_info['Deductions']; if ($balance > 0) { $cd_pay_status = 'payable'; } mysql_query("Update `cs_companydetails` set `cd_pay_status`='{$cd_pay_status}' WHERE userId = '" . $companyInfo['userId'] . "'"); $log .= " " . $companyInfo['companyname'] . "={$cd_pay_status}, balance={$balance}\n"; } $time = microtime_float(); $log .= mysql_num_rows($result) . " Companys Updated in {$time} Seconds.\n"; toLog('misc', 'system', $log); }
$mi_notes = $_POST['mi_notes']; $bank_ids = $_POST['paybank']; $deduct_bank = $_POST['deductbank']; $paid = payCompany($paydate); $mi_ID = $paid; if ($paid != -1) { $msg = "Merchant Paid Successfully (Invoice #{$mi_ID} Created)"; } else { $msg = "Error paying Merchant! ~ {$error_msg}"; } } unset($bank_ids); unset($date_hold); unset($date_delay); $paydate = strtotime($companyInfo['cd_next_pay_day']); $mi_pay_info = calcReal($paydate); ?> <script language="javascript"> <!-- var BankList = new Array();; var BankInfo = new Array();; var EtelDeductions = '<?php echo $mi_pay_info['EtelDeductions']; ?> '; var BankInc = 0; function payChange(obj) { if(!obj.checked) document.getElementById('deductbank_'+obj.value).checked = false; document.getElementById('deductbank_'+obj.value).disabled = !obj.checked;