示例#1
0
function getReportBalance($reportId, $conexionHandler)
{
    $totalReported = getReportTotal($reportId, $conexionHandler);
    $totalPaid = getReportPaid($reportId, $conexionHandler);
    return decimalPad($totalReported - $totalPaid);
}
            $reportTotal = getReportTotal($payment['reportId'], $conexion);
            if ($firstBroker) {
                $firstBroker = false;
                $reportPaid = mysql_fetch_assoc(mysql_query("select * from report JOIN broker using (brokerId) where reportId = " . $payment['reportId'], $conexion));
                $tableHolder .= "<td rowspan='" . $reportInfo['totalCheques'] . "'>" . $reportPaid['brokerName'] . "</td>";
            } else {
                $tableHolder .= "</tr><tr>\n";
            }
            $tableHolder .= "<td>" . $payment['reportId'] . "</td>";
            $tableHolder .= "<td>" . decimalPad($reportTotal) . "</td>";
        }
        $tableHolder .= "</tr>\n";
    } else {
        //just one report
        $reportPaid = mysql_fetch_assoc(mysql_query("select * from report JOIN broker using (brokerId) where reportId = " . $reportInfo['reportId'], $conexion));
        $reportTotal = getReportTotal($reportInfo['reportId'], $conexion);
        $tableHolder .= "<tr>";
        $tableHolder .= "<td>" . to_MDY($reportInfo['paidchequesDate']) . "</td>";
        $tableHolder .= "<td>" . $reportInfo['paidchequeNumber'] . "</td>";
        $tableHolder .= "<td align='right'>" . decimalPad($reportInfo['totalPaid']) . "</td>";
        $tableHolder .= "<td>" . $reportPaid['brokerName'] . "</td>";
        $tableHolder .= "<td>" . $reportPaid['reportId'] . "</td>";
        $tableHolder .= "<td align='rigth'>" . decimalPad($reportTotal) . "</td>";
        $tableHolder .= "</tr>\n";
    }
    $globalTotal += $reportInfo['totalPaid'];
}
echo "<tr><td colspan='2'></td><td align='right'>" . decimalPad($globalTotal) . "</td><td colspan='3'></td></tr>";
?>
<tr>
	<th>Date</th>
$reports = mysql_query($queryReports, $conexion);
$tbody = "<table class='listing form' cellpadding='0' cellspacing='0' ><tr>
	<th>ID</th>
	<th>Broker</th>
	<th>Driver</th>
	<th>Report Date</th>
	<th>Start Date</th>
	<th>End Date</th>
	<th>Due Date</th>
	<th>Total</th>
	<th>Paid</th>
	<th>Balance</th>
	<th colspan='2'></th>
</tr>";
while($invoice = mysql_fetch_assoc($reports)) {
	$reportTotal = getReportTotal($invoice['reportId'], $conexion);
	$paidTotal = getReportPaid($invoice['reportId'], $conexion);
	
	if($paidTotal == null || $paidTotal <= 0 ){ $paid = 'Unpaid';if($paidR)continue;}
	if($paidTotal != null && $paidTotal >= $reportTotal && $paidTotal != 0){ $paid = 'Paid'; if($unpaidR)continue;}
	if($paidTotal != null && $paidTotal > 0 && $paidTotal < $reportTotal){ $paid = 'Warning';if($paidR)continue;}
	if($paidTotal != null && $paidTotal > $reportTotal){ $paid = 'Overpaid'; if($unpaid)continue;}
	
	if($colorFlag){$tbody.= "<tr class='even".$paid." printable' id='report".$invoice['reportId']."' invoice='".$invoice['reportId']."'>";}
	else{$tbody.= "<tr class='odd".$paid." printable' id='report".$invoice['reportId']."' invoice='".$invoice['reportId']."'>";}
	$colorFlag=!$colorFlag;
	
	$tbody.= "<td>".$invoice['reportId']."</td>";
	$tbody.= "<td>".$invoice['brokerPid']."</td>";
	$tbody.= "<td>".($invoice['driverFirstName']==null?'----':$invoice['driverLastName'].", ".$invoice['driverFirstName'])."</td>";
	$tbody.= "<td>".to_MDY($invoice['reportDate'])."</td>";
示例#4
0
	//console.log(data);
	return data;
}
</script>
<div id='formDiv' class='table'>
	<img src="/mfi/img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
	<img src="/mfi/img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
	<table class="listing form" cellpadding="0" cellspacing="0">
		<tr>
			<th colspan='2'>New Pay Cheque for Broker Invoice [<?php 
echo $reportId;
?>
]</th>
		</tr>
		<?php 
$reportTotal = getReportTotal($reportId, $conexion);
$paidTotal = getReportPaid($reportId, $conexion);
$reportInfo = getBasicReportInfo($conexion, $reportId);
$balance = decimalPad($reportTotal - $paidTotal);
$nextCheck = getNextAutoIncrement($conexion, 'paidcheques');
//Truck
$flag = true;
echo createFormRowTextField('Check Id', 'newBrokerChequeId', $flag ? 'class="bg"' : '', true, " disabled='disabled' size='10px' value='" . $nextCheck . "'");
$flag = !$flag;
echo createFormRowTextField('Check Number', 'newBrokerCheckNumber', $flag ? 'class="bg"' : '', false, "size='10px' ");
$flag = !$flag;
echo createFormRowTextField('Check Date', 'newBrokerCheckDate', $flag ? 'class="bg"' : '', false, "size='10px' value='" . to_MDY($reportInfo['reportDate']) . "'");
$flag = !$flag;
echo createFormRowTextField('Amount', 'newBrokerCheckAmount', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $balance . "'");
$flag = !$flag;
?>