Пример #1
0
         $YPos -= $line_height;
     }
     //end while there are outstanding transaction to print
 }
 // end if there are outstanding transaction to print
 /* check to see enough space left to print the totals/footer
 			which is made up of 2 ruled lines, the totals/aging another 2 lines
 			and details of the last payment made - in all 6 lines */
 if ($YPos - $Bottom_Margin < 4 * $line_height) {
     /* head up a new statement/credit note page */
     $PageNumber++;
     $pdf->newPage();
     include 'includes/PDFStatementPageHeader.inc';
 }
 /*Now figure out the aged analysis for the customer under review */
 $SQL = "SELECT debtorsmaster.name,\n\t\t\t\t\t\tcurrencies.currency,\n\t\t\t\t\t\tpaymentterms.terms,\n\t\t\t\t\t\tdebtorsmaster.creditlimit,\n\t\t\t\t\t\tholdreasons.dissallowinvoices,\n\t\t\t\t\t\tholdreasons.reasondescription,\n\t\t\t\t\t\tSUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc) AS balance,\n\t\t\t\t\t\tSUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN\n\t\t\t\t\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >=\n\t\t\t\t\t\t\tpaymentterms.daysbeforedue\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1', 'MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= 0\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tEND) AS due,\n\t\t\t\t\t\tSum(CASE WHEN paymentterms.daysbeforedue > 0 THEN\n\t\t\t\t\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue\n\t\t\t\t\t\t\tAND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >=\n\t\t\t\t\t\t\t(paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ")\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1', 'MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ")\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tEND) AS overdue1,\n\t\t\t\t\t\tSum(CASE WHEN paymentterms.daysbeforedue > 0 THEN\n\t\t\t\t\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue\n\t\t\t\t\t\t\tAND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue +\n\t\t\t\t\t\t\t" . $_SESSION['PastDueDays2'] . ")\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1', 'MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . "))\n\t\t\t\t\t\t\t>= " . $_SESSION['PastDueDays2'] . ")\n\t\t\t\t\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight +\n\t\t\t\t\t\t\tdebtortrans.ovdiscount - debtortrans.alloc\n\t\t\t\t\t\t\tELSE 0 END\n\t\t\t\t\t\tEND) AS overdue2\n\t\t\t\t\tFROM debtorsmaster INNER JOIN paymentterms\n\t\t\t\t\t\tON debtorsmaster.paymentterms = paymentterms.termsindicator\n\t\t\t\t\tINNER JOIN currencies\n\t\t\t\t\t\tON debtorsmaster.currcode = currencies.currabrev\n\t\t\t\t\tINNER JOIN holdreasons\n\t\t\t\t\t\tON debtorsmaster.holdreason = holdreasons.reasoncode\n\t\t\t\t\tINNER JOIN debtortrans\n\t\t\t\t\t\tON debtorsmaster.debtorno = debtortrans.debtorno\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tdebtorsmaster.debtorno = '" . $StmtHeader['debtorno'] . "'";
 if ($_SESSION['SalesmanLogin'] != '') {
     $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
 }
 $sql .= " GROUP BY\n \t\t\t\t\t\tdebtorsmaster.name,\n\t\t\t\t\t\tcurrencies.currency,\n\t\t\t\t\t\tpaymentterms.terms,\n\t\t\t\t\t\tpaymentterms.daysbeforedue,\n\t\t\t\t\t\tpaymentterms.dayinfollowingmonth,\n\t\t\t\t\t\tdebtorsmaster.creditlimit,\n\t\t\t\t\t\tholdreasons.dissallowinvoices,\n\t\t\t\t\t\tholdreasons.reasondescription";
 $ErrMsg = 'The customer details could not be retrieved by the SQL because';
 $CustomerResult = DB_query($SQL, $db);
 /*there should be only one record returned ?? */
 $AgedAnalysis = DB_fetch_array($CustomerResult, $db);
 /*Now print out the footer and totals */
 $DisplayDue = locale_number_format($AgedAnalysis['due'] - $AgedAnalysis['overdue1'], $StmtHeader['currdecimalplaces']);
 $DisplayCurrent = locale_number_format($AgedAnalysis['balance'] - $AgedAnalysis['due'], $StmtHeader['currdecimalplaces']);
 $DisplayBalance = locale_number_format($AgedAnalysis['balance'], $StmtHeader['currdecimalplaces']);
 $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1'] - $AgedAnalysis['overdue2'], $StmtHeader['currdecimalplaces']);
 $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'], $StmtHeader['currdecimalplaces']);
 $pdf->line($Page_Width - $Right_Margin, $Bottom_Margin + 4 * $line_height, $Left_Margin, $Bottom_Margin + 4 * $line_height);
Пример #2
0
    @($cid = $_GET['cid']);
    @($config = $_GET['cof']);
} else {
    die("invild action");
}
switch ($do) {
    case "huati":
        huati();
        echo "<script>alert('话题已经修改!');location.href='sysset.php';</script>";
        break;
    case "huanying1":
        huanying1();
        echo "<script>alert('恭喜你,欢迎语1已经修改,请前往前台测试。');location.href='sysset.php';</script>";
        break;
    case "interval":
        interval();
        break;
    case "refreshtime":
        refreshtime();
        break;
    case "huanying2":
        huanying2();
        echo "<script>alert('恭喜你,欢迎语2已经修改,请前往前台测试。');location.href='sysset.php';</script>";
        break;
    case "success":
        success();
        echo "<script>alert('恭喜你,微信回复已经修改,请在微信进行测试。');location.href='sysset.php';</script>";
        break;
    case "field":
        field();
        echo "<script>alert('恭喜你,微信回复已经修改,请在微信进行测试。');location.href='sysset.php';</script>";
Пример #3
0
function human_diff_months($date, $months, $diff)
{
    if ($months <= 2) {
        // Instead of "x months ago" let's return weeks up to 8
        $weeks = round($diff / interval('week'));
        $date = apply_filters('ubik_time_human_diff_weeks', sprintf(_n('%s week ago', '%s weeks ago', $weeks, 'ubik'), $weeks), $weeks, $diff);
    }
    return $date;
}
Пример #4
0
function td($range, $min_ticks)
{
    global $p, $n_tests, $n_pass, $n_fail;
    $n_tests++;
    $result = $p->test_CalcStepDatetime($range, $min_ticks);
    report('Date', $range, $min_ticks, $result, interval($result));
    $err = check_result('date', $min_ticks, $range, $result);
    if (empty($err)) {
        $n_pass++;
    } else {
        $n_fail++;
        echo $err;
    }
}