</strong></td> <td width="100" align="right"><strong><?php echo _PAYMENT_LIST_CHARGE; ?> </strong></td> <td width="100" align="right"><strong><?php echo _PAYMENT_LIST_TOTAL; ?> </strong></td> </tr> </table> <?php $database = new SyncDatabase(); $colorRow = 1; foreach ($database->Select('contract', array('canceled' => 0), 0) as $contract) { $object = $database->Value('object_rental', array('object_id' => $contract['object_id']), 0); $objectType = $database->Value('object_type', array('type_id' => $object['type_id']), 0); $listCustomer[$contract['cus_id']] = array(); $listCustomer[$contract['cus_id']]['pay'] = 0; $listCustomer[$contract['cus_id']]['charge'] = 0; $listCustomer[$contract['cus_id']]['total'] = 0; $listCustomer[$contract['cus_id']]['list'] = 0; foreach ($database->Select('customer', array('cus_id' => $contract['cus_id']), 0) as $customer) { foreach ($database->Select('payment', array('contract_id' => $contract['contract_id'], 'paid' => 0), 0) as $payment) { $listCustomer[$customer['cus_id']]['list']++; $listCustomer[$customer['cus_id']]['pay'] += $payment['amount']; $listCustomer[$customer['cus_id']]['charge'] += $payment['charge']; $listCustomer[$customer['cus_id']]['total'] += $payment['amount'] + $payment['charge']; } } if ($colorRow % 2 == 0) {
} if ($_GET['action'] == 'pay') { if (isset($_GET['id'])) { $database->Update('payment', array('paid' => 1), array('pay_id' => $_GET['id'])); header("Location:?pay=ment"); exit; } elseif (isset($_GET['customer'])) { foreach ($database->Select('contract', array('cus_id' => $_GET['customer']), 0) as $contract) { $database->Update('payment', array('paid' => 1), array('contract_id' => $contract['contract_id'])); } header("Location:?pay=ment"); exit; } } else { if (isset($_GET['customer'])) { $customer = $database->Value('customer', array('cus_id' => $_GET['customer']), 0); $listCustomer['pay'] = 0; $listCustomer['charge'] = 0; $listCustomer['total'] = 0; foreach ($database->Select('contract', array('cus_id' => $customer['cus_id']), 0) as $contract) { foreach ($database->Select('payment', array('contract_id' => $contract['contract_id'], 'paid' => 0), 0) as $payment) { $listCustomer['pay'] += $payment['amount']; $listCustomer['charge'] += $payment['charge']; $listCustomer['total'] += $payment['amount'] + $payment['charge']; } } ?> <form action="" method="POST" name="employee_register" id="employee_register"> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;">
echo _PAYMENT_LIST_TOTAL; ?> </strong></td> </tr> </table> <?php $database = new SyncDatabase(); $colorRow = 1; foreach ($database->Select('customer', 0, 0) as $customer) { $listCustomer[$customer['cus_id']] = array(); $listCustomer[$customer['cus_id']]['pay'] = 0; $listCustomer[$customer['cus_id']]['charge'] = 0; $listCustomer[$customer['cus_id']]['total'] = 0; $listCustomer[$customer['cus_id']]['list'] = 0; foreach ($database->Select('contract', array('cus_id' => $customer['cus_id']), 0) as $contract) { $listCustomer[$customer['cus_id']]['object'] = $database->Value('object_rental', array('object_id' => $contract['object_id']), 0); $listCustomer[$customer['cus_id']]['type'] = $database->Value('object_type', array('type_id' => $listCustomer[$customer['cus_id']]['object']['type_id']), 0); $listCustomer[$customer['cus_id']]['payment'] = $database->Value('payment', array('contract_id' => $contract['contract_id'], 'paid' => 0), 0); $listCustomer[$customer['cus_id']]['object'] = $listCustomer[$customer['cus_id']]['object']['detail']; $listCustomer[$customer['cus_id']]['type'] = $listCustomer[$customer['cus_id']]['type']['type_name']; $listCustomer[$customer['cus_id']]['payment'] = $listCustomer[$customer['cus_id']]['payment']['pay_date']; $listCustomer[$customer['cus_id']]['paid'] = $database->Count('payment', array('contract_id' => $contract['contract_id'], 'amount' => $contract['cost'], 'paid' => 0), 0); foreach ($database->Select('payment', array('contract_id' => $contract['contract_id'], 'paid' => 0), 0) as $payment) { $listCustomer[$customer['cus_id']]['list']++; $listCustomer[$customer['cus_id']]['pay'] += $payment['amount']; $listCustomer[$customer['cus_id']]['charge'] += $payment['charge']; $listCustomer[$customer['cus_id']]['total'] += $payment['amount'] + $payment['charge']; } } if ($listCustomer[$customer['cus_id']]['total'] != 0) { if ($listCustomer[$customer['cus_id']]['paid'] > 2) {
:</strong></td> <td align="left" valign="top"><?php echo $_REQUEST['regis_telephone']; ?> </td> </tr> <tr> <td align="right" valign="top"> </td> <td align="left" valign="top"> </td> </tr> </table> </td> </tr> </table> <?php $idNewCustomer = $database->Value('customer', array('idcard' => $_REQUEST['regis_idcard']), 0); ?> <script> $(document).ready(function(){ $('#register_edit').click(function(){ $(this).href('customer=edit&id=<?php echo $idNewCustomer['cus_id']; ?> '); }); $('#register_success').click(function(){ $(this).href('customer=view'); }); }); </script>
<?php $database = new SyncDatabase(); $contract = $database->Value('contract', array('contract_id' => $_GET['id']), 0); if (!isset($_GET['action'])) { $_GET['action'] = ''; } if ($_GET['action'] == 'confirm') { $editContract = array('cancel_date' => $_REQUEST['timestamp']); $database->Update('contract', $editContract, array('contract_id' => $_GET['id'])); ?> <script> $(document).ready(function() { $(this).href('contract=edit&id=<?php echo $_GET['id']; ?> '); }); </script><?php } elseif ($_GET['action'] == 'canceled') { $isToday = getdate(time()); ?> <form name="canceled" method="post" action="?contract=edit&id=<?php echo $_GET['id']; ?> &action=confirm"> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;"> <input type="submit" name="register_save" id="register_save" value=" " title="<?php echo _IMAGE_TAG_SAVE;
<?php foreach ($database->Select('object_type', 0, 0) as $type) { // contract_id cus_id emp_id object_id cost deposite canceled signup_date cancel_date expire_date $tableConteact = '<table align="left" width="100%" border="0" cellspacing="0" cellpadding="3" id="list-user"><tr>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;"><strong>' . _REGISTER_USERID . '</strong></td>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;"><strong>' . _REGISTER_FULLNAME . '</strong></td>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;" align="center"><strong>' . _INVOICE_CONTRACT_NUMBER . '</strong></td>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;" align="center"><strong>' . _CONTRACT_PRINT_OBJECT . $type['type_name'] . '</strong></td>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;"><strong>' . _CONTRACT_SINGUP . '</strong></td>'; $tableConteact .= '<td style="border-bottom:#333 solid 2px;"><strong>' . _CONTRACT_EXPIRE . '</strong></td>'; $tableConteact .= '</tr>'; $number = 0; foreach ($database->Select('object_rental', array('type_id' => $type['type_id']), 0) as $object) { foreach ($database->Select('contract', array('object_id' => $object['object_id']), 0) as $contract) { $number++; $customer = $database->Value('customer', array('cus_id' => $contract['cus_id']), 0); $idObject = $contract['object_id']; while (strlen($idObject) < 3) { $idObject = '0' . $idObject; } $tableConteact .= '<tr><td>' . $number . '</td><td>' . $customer['fullname'] . '</td>'; $tableConteact .= '<td align="center">' . $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . '-' . $contract['contract_id'] . '</td>'; $tableConteact .= '<td align="center">' . $type['type_id'] . $idObject . '</td>'; $tableConteact .= '<td>' . ThaiDate::Mid($contract['signup_date']) . '</td>'; $tableConteact .= '<td>' . ThaiDate::Mid($contract['expire_date']) . '</td>'; $tableConteact .= '</tr>'; } } $tableConteact .= '</table>'; $data = array('head' => _CONTRACT_PRINT_HEAD, 'date' => _REPORT4_DATE . ThaiDate::Full(time()), 'report_type' => _REPORT4_HEAD1 . $type['type_name'], 'text' => $tableConteact, 'personal' => _REPORT_SIGN); $printButton = '<div style="position:fixed;top:10px;right:10px;"><input type="button" name="print" value="Print" onClick="javascript:window.print()">
?> "> <?php echo 'No. '; $idObject = $object['object_id']; while (strlen($idObject) < 3) { $idObject = '0' . $idObject; } echo '2' . $idObject; ?> </div> <div id="object-detail"> <?php echo '<div style="margin-bottom:6px;font-size:12px;text-decoration:underline;"><strong>' . $typeName['type_name'] . $object['detail'] . '</strong></div>'; if ($object['status_object'] == 1) { $contract = $database->Value('contract', array('object_id' => $object['object_id']), 0); $customer = $database->Value('customer', array('cus_id' => $contract['cus_id']), 0); echo '<div style="margin-bottom:3px;">' . _OBJECT_RENT_BY . ' <strong>' . $customer['fullname'] . '</strong></div>'; echo '<div style="margin-bottom:3px;">' . _OBJECT_RENT_DATE . ThaiDate::Full($contract['signup_date']) . '</div>'; } else { echo '<div>' . _OBJECT_RENT_BYNONE . '</div>'; echo '<span id="object-empty" class="select-' . $object['object_id'] . '">' . _OBJECT_RENT_BLANK . '</span>'; } ?> </div> </div></a> </td> </tr> <?php } ?>
<?php $database = new SyncDatabase(); $employee = $database->Value('employee', array('username' => $_GET['username']), 0); if (isset($_GET['action']) && isset($_POST['register_edit'])) { $isFile = pathinfo($_REQUEST['regis_picture']); list($isWidth, $isHeight, $i, $isAttrImage) = getimagesize($_REQUEST['regis_picture']); if ($isFile['basename'] !== $employee['picture']) { if (file_exists($_REQUEST['regis_picture'])) { $folder_taget = 'images/employee/' . $isFile['basename']; copy($_REQUEST['regis_picture'], $folder_taget); foreach (glob("images/tmpuser/*.*") as $filename) { unlink($filename); } $imageVailds = true; } } $editUser = array('emp_name' => $_REQUEST['regis_fullname'], 'address' => $_REQUEST['regis_address'], 'telephone' => $_REQUEST['regis_telephone']); if ($isFile['basename'] !== $employee['picture']) { $editUser['picture'] = $isFile['basename']; } if ($_REQUEST['regis_password'] !== $employee['password'] && $_REQUEST['regis_password'] !== '') { $editUser['password'] = $_REQUEST['regis_password']; } $database->Update('employee', $editUser, array('username' => $_GET['username'])); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;"> <input type="button" name="register_success" id="register_success" value=" " title="<?php echo _IMAGE_TAG_SUBMIT;
<?php $control = new Session(); $database = new SyncDatabase(); if (isset($_GET['action']) && isset($_POST['register_apply'])) { $customer = $database->Value('customer', array('cus_id' => $_REQUEST['regis_customer']), 0); $object = $database->Value('object_rental', array('object_id' => $_REQUEST['regis_object']), 0); $type = $database->Value('object_type', array('type_id' => $object['type_id']), 0); $user = $database->Value('employee', array('username' => $control->Value('USER_RENTAL')), 0); $newContract = array('cus_id' => $_REQUEST['regis_customer'], 'emp_id' => $user['emp_id'], 'object_id' => $_REQUEST['regis_object'], 'cost' => $type['rentalcost'], 'deposite' => $type['rentalcost'] * 3, 'signup_date' => $_REQUEST['timestamp_signup'], 'expire_date' => $_REQUEST['timestamp_expire']); $database->Insert('contract', $newContract); $idContract = $database->Value('contract', array('signup_date' => $_REQUEST['timestamp_signup']), 0); $newPayment = array('contract_id' => $idContract['contract_id'], 'amount' => $type['rentalcost'] * 3, 'pay_date' => $_REQUEST['timestamp_signup']); $database->Insert('payment', $newPayment); $database->Update('object_rental', array('status_object' => 1), array('object_id' => $object['object_id'])); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;"> <input type="button" name="register_pay" id="register_pay" value=" " title="<?php echo _IMAGE_TAG_PAY; ?> " /> <input type="button" name="register_success" id="register_success" value=" " title="<?php echo _IMAGE_TAG_BACK; ?> " /> </td> <td align="left" valign="top"> <h4><?php echo _REGISTER_CUSTOMER_ADD;
<?php $database = new SyncDatabase(); $customer = $database->Value('customer', array('cus_id' => $_GET['id']), 0); if (isset($_GET['action']) && isset($_POST['register_edit'])) { $editCustomer = array('fullname' => $_REQUEST['regis_fullname'], 'address' => $_REQUEST['regis_address'], 'idcard' => $_REQUEST['regis_idcard'], 'telephone' => $_REQUEST['regis_telephone'], 'job' => $_REQUEST['regis_job']); $database->Update('customer', $editCustomer, array('cus_id' => $_GET['id'])); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;"> <input type="button" name="register_success" id="register_success" value=" " title="<?php echo _IMAGE_TAG_SUBMIT; ?> " /> </td> <td align="left" valign="top"> <h4><?php echo _REGISTER_CUSTOMER_EDIT; ?> </h4> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td align="right" valign="top"> </td> <td align="left" valign="top"> </td> </tr> <tr> <td align="right" valign="top"><strong><?php echo _REGISTER_FULLNAME; ?> :</strong></td>
<?php $database = new SyncDatabase(); $contract = $database->Value('contract', array('contract_id' => $_GET['id']), 0); $customer = $database->Value('customer', array('cus_id' => $contract['cus_id']), 0); $employee = $database->Value('employee', array('emp_id' => $contract['emp_id']), 0); $object = $database->Value('object_rental', array('object_id' => $contract['object_id']), 0); $type = $database->Value('object_type', array('type_id' => $object['type_id']), 0); $isPaydate = $database->Value('payment', array('contract_id' => $contract['contract_id'], 'amount' => $contract['cost']), array(0, 0, 'ORDER BY pay_date DESC LIMIT 0,1')); $payTotal = 0; $changeTotal = 0; foreach ($database->Select('payment', array('contract_id' => $contract['contract_id'], 'paid' => 0), 0) as $payment) { $changeTotal += $payment['charge']; $payTotal += $payment['amount'] + $payment['charge']; } ?> <form action="" method="POST" name="employee_register" id="employee_register"> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="180" align="center" valign="top" style="border-right:#CCC dashed 1px;"> <input type="reset" name="register_reset" id="register_reset" value="" title="<?php echo _IMAGE_TAG_BACK; ?> " /> <input type="button" name="register_print" id="register_print" value="" title="<?php echo _IMAGE_TAG_PRINT; ?> " /></td> <td align="left" valign="top"> <table border="0" cellspacing="0" cellpadding="3"<?php
<h4><?php echo _REGISTER_OBJECT_ADD; ?> </h4> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td align="right" valign="top"> </td> <td align="left" valign="top"> </td> </tr> <tr> <td align="right" valign="top"><strong><?php echo _REGISTER_TYPE; ?> :</strong></td> <td align="left" valign="top"><?php $typeName = $database->Value('object_type', array('type_id' => $_REQUEST['regis_type']), 0); echo $typeName['type_name']; ?> </td> </tr> <tr> <td width="150" align="right" valign="top"><strong><?php echo _REGISTER_STATUS; ?> :</strong></td> <td width="150" align="left" valign="top"><?php echo _OBJECT_RENT_BLANK; ?> </td> </tr> <tr>