$text .= _CONTRACT_PRINT_SIGNUP . ThaiDate::Mid($contract['signup_date']) . _CONTRACT_PRINT_TO . ThaiDate::Mid($contract['expire_date']) . _CONTRACT_PRINT_EXPIRE; $text .= _CONTRACT_PRINT_RENT . number_format($contract['cost'], 0) . _CONTRACT_PRINT_BAHT . _CONTRACT_PRINT_TEXT3; $text .= '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT4 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT5 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT6 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT7_1 . number_format($contract['deposite'], 0) . _CONTRACT_PRINT_TEXT7_2 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT8 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT9 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT10 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT11 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT12 . '</span><br/>'; $data = array('id' => _CONTRACT_PASS . $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . '-' . $contract['contract_id'], 'head' => _CONTRACT_PRINT_HEAD, 'singup' => _CONTRACT_TIME . ThaiDate::Full($contract['signup_date']), 'expire' => $expire, 'contract_type' => _CONTRACT_HEAD . $type['type_name'], 'text' => $text, 'personal' => _CONTRACT_PRINT_PERSONAL, 'own' => _CONTRACT_PRINT_OWN); $printButton = '<div style="position:fixed;top:10px;right:10px;"><input type="button" name="print" value="Print" onClick="javascript:window.print()"> <input type="button" name="close" value="Close" onClick="javascript:window.close()"></div>'; $content = site::Content('contract', $data); $targetDirectory = "document/"; $targetName = "contract"; $targetID = $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . $contract['contract_id']; $targetExtension = ".html"; $fileName = $targetName . '_' . $targetID . $targetExtension; $isFile = fopen($targetDirectory . $fileName, 'w'); fputs($isFile, $printButton); fputs($isFile, $content); fclose($isFile); ?> <script> $(document).ready(function(){ $('#register_cancel').click(function(){ $(this).href('contract=edit&id=<?php echo $_GET['id'];
<?php echo site::Content('contract', array('id' => '123456'));
$tableConteact .= '<td style="border-top:#333 solid 2px;">' . number_format($totalMoney, 0) . _CONTRACT_PRINT_BAHT . '</td>'; $tableConteact .= '</tr>'; $UnitMoney = array('', _MONEY_1, _MONEY_2, _MONEY_3, _MONEY_4, _MONEY_5, _MONEY_6, '', _MONEY_7); $ThaiMoney = array(_MONEY_ONE, _MONEY_TWO, _MONEY_TREE, _MONEY_FOUR, _MONEY_FIVE, _MONEY_SIX, _MONEY_SEVEN, _MONEY_EIGHT, _MONEY_NINE); $lenMoney = strlen($totalMoney); $stringMoney = NULL; for ($iloop = 0; $iloop < $lenMoney; $iloop++) { $tmp = substr(strrev($totalMoney), $iloop, 1); if ($tmp != 0) { if ($iloop == 0) { $stringMoney = $ThaiMoney[$tmp - 1] . '' . $stringMoney; } elseif ($iloop == 1) { $stringMoney = $UnitMoney[8] . $UnitMoney[$iloop] . $stringMoney; } else { $stringMoney = $ThaiMoney[$tmp - 1] . $UnitMoney[$iloop] . $stringMoney; } } } $tableConteact .= '<tr><td align="right" colspan="2">' . $stringMoney . _CONTRACT_PRINT_BAHT . '</td>'; $tableConteact .= '</tr>'; $tableConteact .= '</table>'; $data = array('head' => _CONTRACT_PRINT_HEAD, 'date' => _REPORT4_DATE . ThaiDate::Full(time()), 'report_type' => _REPORT3_HEAD1 . $type['type_name'] . _REPORT3_HEAD2 . $date, 'text' => $tableConteact, 'personal' => _REPORT_SIGN); $content = site::Content('report1', $data); $targetDirectory = "document/"; $fileName = 'report4_' . $type['type_id'] . '-' . $key . '.html'; $isFile = fopen($targetDirectory . $fileName, 'w'); fputs($isFile, $printButton); fputs($isFile, $content); fclose($isFile); } }
$listMoney .= _PAYMENT_PAYRENT; } else { $listMoney .= _PAYMENT_DEPOSITE; } $listMoney .= '</span></td>'; $listMoney .= '<td align="right" valign="middle"><span style="margin-left:40px;">' . number_format($payment['amount'] + $payment['charge'], 2) . '</span></td></tr>'; if ($payment['pay_date'] > $dueDate) { $dueDate = $payment['pay_date']; } $moneyTotal += $payment['amount'] + $payment['charge']; } $listMoney .= '</table>'; $data = array('head' => _CONTRACT_PRINT_HEAD, 'today' => _INVOICE_DAY . ThaiDate::Full(time()), 'invoice' => _INVOICE_HEAD, 'contract_id' => '<strong>' . _INVOICE_CONTRACT_NUMBER . '</strong> ' . $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . '-' . $contract['contract_id'], 'object_id' => '<strong>' . _CONTRACT_PRINT_OBJECT . $type['type_name'] . '</strong> ' . $type['type_id'] . $idObject, 'name' => '<strong>' . _REGISTER_FULLNAME . '</strong> ' . $customer['fullname'], 'address' => '<strong>' . _REGISTER_ADDRESS . '</strong> ' . $customer['address'], 'due_date' => '<strong>' . _INVOICE_PAY_DUE . '</strong> ' . ThaiDate::Full($dueDate), 'pay_head' => '<strong>' . _INVOICE_PAY_HEADTOTAL . '</strong>', 'list' => $listMoney, 'pay_total' => '<strong>' . _INVOICE_PAY_TOTAL . '</strong>', 'pay_money_total' => '<strong>' . number_format($moneyTotal, 2) . '</strong>', 'personal' => _INVOICE_PAY_MONEY); $printButton = '<div style="position:fixed;top:10px;right:10px;"><input type="button" name="print" value="Print" onClick="javascript:window.print()"> <input type="button" name="close" value="Close" onClick="javascript:window.close()"></div>'; $content = site::Content('invoice', $data); $targetDirectory = "document/"; $targetName = "invoice"; $targetID = $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . $contract['contract_id']; $targetExtension = ".html"; $fileName = $targetName . '_' . $targetID . $targetExtension; $isFile = fopen($targetDirectory . $fileName, 'w'); fputs($isFile, $printButton); fputs($isFile, $content); fclose($isFile); ?> <script> $(document).ready(function(){ $('#register_cancel').click(function(){ $(this).href('contract=edit&id=<?php echo $_GET['id'];