示例#1
0
 public function insertBatch($accounts_id, $bpartner_id = 0)
 {
     global $defaultorganization_id;
     //$this->accounts_id = $this->getLatestAccountsID();
     $batchno = getNewCode($this->xoopsDB, "batchno", $this->tablebatch);
     $timestamp = date("y/m/d H:i:s", time());
     $sqlbatch = "INSERT INTO {$this->tablebatch} \r\n\t\t\t(batch_name,\r\n\t\t\treuse,\r\n\t\t\tcreated,createdby,updated,updatedby,\r\n\t\t\tperiod_id,\r\n\t\t\torganization_id,batchno,iscomplete,isshow) \r\n\t\t\tvalues\r\n\t\t\t('',0,'{$timestamp}',{$this->createdby},'{$timestamp}',{$this->updatedby},\r\n\t\t\t0,{$defaultorganization_id},'{$batchno}',1,0)";
     $this->log->showLog(4, "Before insert batch SQL:{$sqlbatch}");
     $rs = $this->xoopsDB->query($sqlbatch);
     if (!$rs) {
         $this->log->showLog(1, __FILE__ . ", LINE:" . __LINE . ":Failed to insert batch account code {$accounts_name}:" . mysql_error() . ":{$sqlbatch}");
         return false;
     } else {
         $batch_id = $this->getLatestBatchID();
         $amtob = $this->openingbalance;
         if ($this->openingbalance == "") {
             $amtob = 0;
         }
         $sqltrans = "INSERT INTO {$this->tabletransaction} (seqno,batch_id,accounts_id,amt,bpartner_id)\r\n\t\t\t\tVALUES (0,{$batch_id},{$accounts_id},{$amtob},{$bpartner_id})";
         $this->log->showLog(4, "Before insert batch SQL:{$sqltrans}");
         $rs = $this->xoopsDB->query($sqltrans);
         if (!$rs) {
             $this->log->showLog(1, __FILE__ . ", LINE:" . __LINE . ":Failed to insert transaction account code {$accounts_name}:" . mysql_error() . ":{$sqltrans}");
             return false;
         } else {
             //$this->updateOpeningBalance($amtob,0);
         }
     }
 }
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int bankreconcilation_id 
     * @return 
     * @access public
     */
    public function getInputForm($type, $bankreconcilation_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        global $defcurrencycode;
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $reusectrl = "";
        $styledate = "";
        $stylecalendar = "";
        $styleclosing = "";
        $orgctrl = "";
        //$this->created=0;
        $addnewctrl = "<a href='bankreconcilation.php'>[ Add New ]</a><a href='bankreconcilation.php?action=showsearchform'>[ Search ]</a>";
        if ($type == "new") {
            $header = "New Bank Reconcilation";
            $action = "create";
            $this->iscomplete = 0;
            if ($bankreconcilation_id == 0) {
                $this->bankreconcilationno = getNewCode($this->xoopsDB, "bankreconcilationno", $this->tablebankreconcilation);
                $this->statementbalance = "0.00";
                //$this->bankreconcilationdate= date("Y-m-d", time()) ;
                $this->bankreconcilationdate = getDateSession();
            }
            //$savectrl="";
            //$savectrl="<input style='height: 40px;' name='btnSave' value='Save' type='button' onclick='validateBankReconcilationSave();'>";
            $savectrl = "<input name='bankreconcilation_id' value='{$this->bankreconcilation_id}' type='hidden'>\r\n\t\t\t <input style='height: 40px;' name='btnSave' value='Save' type='submit' onclick='iscomplete.value=0;'>";
            $completectrl = "<input style='height: 40px;display:none' name='btncomplete' value='Complete' type='submit' \t\r\n\t\t\t\tonclick='iscomplete.value=1;'>";
            $checked = "";
            $deletectrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
            $transactionctrl = "";
            /*			$defaultcurrencysetting="<tr><td class='head'>Currency</td>
            				<td class='even' >$this->currencyctrl Organization Currency: $defcurrencycode</TD>
            				<td class='head'>Conversion Rate</td>
            				<td class='even'><input value='$this->conversionrate' name='conversionrate'></td>
            			</tr>";*/
        } else {
            $selectadd0line = "SELECTED='SELECTED'";
            $selectadd1line = "";
            //$styledate="readonly";
            //$stylecalendar="style='display:none'";
            //	$defaultcurrencysetting="";
            $action = "update";
            if ($this->iscomplete == 0) {
                $savectrl = "<input name='bankreconcilation_id' value='{$this->bankreconcilation_id}' type='hidden'>\r\n\t\t\t <input style='height: 40px;' name='btnSave' value='Save' type='submit' onclick='iscomplete.value=0;'>";
                $stylecomplete = "display:none";
                if ($this->differenceamt == 0) {
                    $stylecomplete = "";
                }
                $completectrl = "<input style='height: 40px;{$stylecomplete}' name='btncomplete' value='Complete' type='submit' onclick='iscomplete.value=1;'>";
                $readonlyctrl = "";
            } else {
                $readonlyctrl = "readonly='readonly'";
                $savectrl = " <input name='btncomplete' type='hidden'>";
            }
            $defaultsetting = "";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$tablebankreconcilation}' type='hidden'>" . "<input name='id' value='{$this->bankreconcilation_id}' type='hidden'>" . "<input name='idname' value='bankreconcilation_id' type='hidden'>" . "<input name='title' value='BankReconcilation' type='hidden'>" . "<input name='btnRecord' value='View Record Info' type='submit'>" . "</form>";
            }
            //force reuse checkbox been checked if the value in db is 'Y'
            if ($this->reuse == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            if ($this->iscomplete == 0) {
                $docstatus = "Draft";
            } else {
                $docstatus = "Completed";
            }
            $header = "Edit Bank Reconcilation";
            if ($this->allowDelete($this->bankreconcilation_id) && $this->iscomplete == 0) {
                $deletectrl = "<FORM action='bankreconcilation.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this bankreconcilation?"' . ")'><input type='submit' value='Delete' name='btnDelete' style='height: 40px;'>" . "<input type='hidden' value='{$this->bankreconcilation_id}' name='bankreconcilation_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            if ($this->iscomplete == 1) {
                $reactivatectrl = "<FORM action='bankreconcilation.php' method='POST' onSubmit='return confirm(" . '"confirm to re-activate this bankreconcilation?"' . ")'><input style='height: 40px;' type='submit' value='Activate' name='btnActivate'>" . "<input type='hidden' value='{$this->bankreconcilation_id}' name='bankreconcilation_id'>" . "<input type='hidden' value='reactivate' name='action'>\r\n\t\t<input name='token' value='{$token}' type='hidden'>\r\n\t\t</form>";
            } elseif ($this->iscomplete == -1) {
                $reactivatectrl = "<b style='color: red'>Reversed By {$this->fromsys}</b>";
            }
            $printctrl = "<Form method='GET' target='_blank' action='viewbankreconcilationreport.php'>\r\n\t\t\t\t<input name='submit' value='Print Preview' type='submit'>\r\n\t\t\t\t<input name='bankreconcilation_id' value='{$this->bankreconcilation_id}' type='hidden'></Form>";
        }
        if ($this->reconcilamt == "") {
            $this->reconcilamt = 0;
        }
        if ($this->unreconcilamt == "") {
            $this->unreconcilamt = 0;
        }
        echo <<<EOF
{$addnewctrl}

<form onsubmit="return validateBankReconcilation()" method="post"
 action="bankreconcilation.php" name="frmBankReconcilation">
<table style="width:140px;"><tbody><td><input name="reset" value="Reset" type="reset"></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="1" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" >{$this->orgctrl}</td>
\t<td class="head">Bank Accounts</td>
\t<td class="even" >{$this->accountsctrl}<input name='account_balance' value="{$this->account_balance}" readonly='readonly'></td>

  
      </tr>
      <tr>
        <td class="head">New Statement Balance</td>
        <td class="even" ><input name='statementbalance' value="{$this->statementbalance}" size='15'style='text-align:right' onchange='calculateBalance()'>
\t\t</TD>

\t<td class="head">Last Statement Balance</td>
\t<td class="even" ><input name='laststatementbalance' value="{$this->laststatementbalance}" readonly="readonly"  size='15'style='text-align:right'></td>

      </tr>

  
   <tr>
 \t   \t<td class="head">Bank Reconcilation No {$mandatorysign}</td>
        <td class="even" ><input name='bankreconcilationno' value={$this->bankreconcilationno} {$readonlyctrl}> </td>

\t<td class="head">Difference Amount</td>
\t<td class="even" ><input name='differenceamt' value="{$this->differenceamt}" readonly="readonly" size='15' {$readonlyctrl} 
\t\tstyle='text-align:right'> \t
\t\t\t<input type='hidden' name='iscomplete' value="{$this->iscomplete}">
\t\t\t<input type='hidden' name='reconcilamt' value="{$this->reconcilamt}">
\t\t\t<input type='hidden' name='unreconcilamt' value="{$this->unreconcilamt}"></td>
      </tr>

   <tr>
 \t<td class="head">Bank Statement Date</td>
\t<td class="even" >
\t<input id='bankreconcilationdate' name='bankreconcilationdate' value="{$this->bankreconcilationdate}" size="8">
\t<input type='button' onclick="{$this->showcalendar}" value='Date' {$stylecalendar} {$readonlyctrl}>
\t<br>Period&nbsp;{$this->periodctrl}
\t</td>

\t<td class="head">Last Statement Date</td>
\t<td class="even" ><input name='laststatementdate' id='laststatementdate' value="{$this->laststatementdate}"  readonly="readonly"></td>
      </tr>
\t\t<td class="head">Transaction</td><td  class="even" colspan='3'><div id='childtable'>{$this->transctrl}</div></td>
    </tbody>
  </table>
<table style="width:150px;"><tbody><tr><td {$styleclosing}>{$savectrl} 
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td><td>{$completectrl}</td>
\t</form><td {$styledelete}>{$deletectrl}</td><td {$styleclosing}>{$reactivatectrl}</td><td>{$printctrl}</td></tr></tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#3
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int studentinvoice_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $studentinvoice_id, $token)
    {
        global $isreadonlywindows;
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $previewctrl = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New";
            $action = "create";
            if ($studentinvoice_id == 0) {
                $this->studentcharges_name = "";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $studentchargeschecked = "CHECKED";
                $this->studentinvoice_no = getNewCode($this->xoopsDB, "studentinvoice_no", $this->tablestudentinvoice, "");
                $this->studentcharges_date = getDateSession();
                $this->studentinvoice_lineamt = 0;
            }
            $savectrl = "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='studentinvoiceline_id' value='{$this->studentinvoiceline_id}' type='hidden'>" . "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablestudentinvoice}' type='hidden'>" . "<input name='id' value='{$this->studentinvoice_id}' type='hidden'>" . "<input name='idname' value='studentinvoice_id' type='hidden'>" . "<input name='title' value='Studentcharges' type='hidden'>" . "<input name='btnView' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit";
            if ($this->allowDelete($this->studentinvoice_id)) {
                $deletectrl = "<FORM action='studentcharges.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this studentcharges?"' . ")'><input type='submit' value='Delete' name='btnDelete'>" . "<input type='hidden' value='{$this->studentinvoiceline_id}' name='studentinvoiceline_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='studentcharges.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
            $previewctrl = "<FORM target='_blank' action='viewstudentcharges.php' method='POST' aonSubmit='return confirm(" . '"confirm to remove this studentcharges?"' . ")'><input type='submit' value='Preview' name='btnPreview'>" . "<input type='hidden' value='{$this->studentinvoice_id}' name='studentinvoice_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
        }
        $searchctrl = "<Form action='studentcharges.php' method='POST'>\r\n                            <input name='btnSearch' value='Search' type='submit'>\r\n                            <input name='action' value='search' type='hidden'>\r\n                            </form>";
        $stylesave = "";
        if ($this->studentinvoice_id > 0) {
            $stylesave = "style='display:none'";
        }
        $actionform = 'action="studentcharges.php"';
        $this->styleviewwindows = "";
        if ($isreadonlywindows == 1) {
            $addnewctrl = "";
            $deletectrl = "";
            $savectrl = "";
            $actionform = 'onsubmit="return false"';
            $this->styleviewwindows = "style='display:none'";
        }
        echo <<<EOF


<table style="width:140px;">
<tbody>
<td>{$addnewctrl}</td>
<td>{$searchctrl}</td>
<td><form onsubmit="return validateStudentcharges()" method="post"
 action="studentcharges.php" name="frmStudentcharges"  enctype="multipart/form-data"><input name="reset" value="Reset" type="reset"></td></tbody></table>


  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
        <tr>
        <th colspan="4" rowspan="1">{$header}</th>
        </tr>

        <tr>
        <td class="head">Student</td>
        <td class="even" colspan="3">{$this->studentctrl}</td>
        </tr>

        <tr>
        <td class="head">Item</td>
        <td class="even">
        <input maxlength="100" size="30" name="studentinvoice_item" value="{$this->studentinvoice_item}">
        <a title="Add By Product" style="cursor:pointer" onclick="viewProduct()"> >> </a><br>
        <div id="idProductCtrl" style="display:none">{$this->productctrl}</div>
        </td>
        <td class="head">Amount (RM)</td>
        <td class="even"><input maxlength="11" size="11" name="studentinvoice_lineamt" value="{$this->studentinvoice_lineamt}"></td>
        </tr>

        <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><textarea name="line_desc" cols="40" rows="4">{$this->line_desc}</textarea></td>
        </tr>
 
    </tbody>
  </table>
EOF;
        echo <<<EOF

<br>
<table astyle="width:150px;"><tbody><td width=1 {$stylesave}>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form>
    <td align="right" {$stylesave}>{$deletectrl}</td>
    </tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#4
0
 public function reUse()
 {
     //global $o;
     $batchno = getNewCode($this->xoopsDB, "batchno", $this->tablebatch);
     $timestamp = date("y/m/d H:i:s", time());
     $sqlheader = "select * from {$this->tablebatch} where batch_id = {$this->batch_id} ";
     $this->log->showLog(3, "Reuse header with SQL:{$sqlheader}");
     $query = $this->xoopsDB->query($sqlheader);
     if ($row = $this->xoopsDB->fetchArray($query)) {
         $organization_id = $row['organization_id'];
         $period_id = $row['period_id'];
         $iscomplete = 0;
         $batch_name = $row['batch_name'];
         $description = $row['description'];
         $created = $timestamp;
         $createdby = $this->updatedby;
         $updated = $timestamp;
         $updatedby = $this->updatedby;
         $reuse = $row['reuse'];
         $totaldebit = $row['totaldebit'];
         $totalcredit = $row['totalcredit'];
         $fromsys = $row['fromsys'];
         $batchdate = $row['batchdate'];
         //$batchdate=substr($timestamp,)
         $sqlinsert = "INSERT INTO {$this->tablebatch} \r\n\t\t\t(organization_id,\r\n\t\t\tperiod_id,\r\n\t\t\tiscomplete,\r\n\t\t\tbatchno,\r\n\t\t\tbatch_name,\r\n\t\t\tdescription,\r\n\t\t\tcreated,\r\n\t\t\tcreatedby,\r\n\t\t\tupdated,\r\n\t\t\tupdatedby,\r\n\t\t\treuse,\r\n\t\t\ttotaldebit,\r\n\t\t\ttotalcredit,\r\n\t\t\tfromsys,\r\n\t\t\tbatchdate) \r\n\r\n\t\t\tvalues \r\n\r\n\t\t\t({$organization_id},\r\n\t\t\t{$period_id},\r\n\t\t\t0,\r\n\t\t\t\"{$batchno}\",\r\n\t\t\t\"{$batch_name}\",\r\n\t\t\t\"{$description}\",\r\n\t\t\t'{$created}',\r\n\t\t\t{$createdby},\r\n\t\t\t'{$updated}',\r\n\t\t\t{$updatedby},\r\n\t\t\t{$reuse},\r\n\t\t\t{$totaldebit},\r\n\t\t\t{$totalcredit},\r\n\t\t\t\"{$fromsys}\",\r\n\t\t\t'{$batchdate}')";
         $this->log->showLog(4, "Before insert reuse SQL:{$sqlinsert}");
         $rs = $this->xoopsDB->query($sqlinsert);
         if (!$rs) {
             $this->log->showLog(1, "Failed to insert reuse code {$batch_name}:" . mysql_error() . ":{$sqlinsert}");
             return false;
         }
     }
     $nextbatchid = $this->getLatestBatchID();
     $sqltransaction = "select * from {$this->tabletransaction} where batch_id = {$this->batch_id} ";
     $this->log->showLog(3, "Reuse transaction with SQL:{$sqltransaction}");
     $query = $this->xoopsDB->query($sqltransaction);
     $i = 0;
     while ($row = $this->xoopsDB->fetchArray($query)) {
         $i++;
         $document_no = $row['document_no'];
         $amt = $row['amt'];
         $originalamt = $row['originalamt'];
         $tax_id = $row['tax_id'];
         //$currency_id=$row['currency_id'];
         $document_no2 = $row['document_no2'];
         $transtype = $row['transtype'];
         $accounts_id = $row['accounts_id'];
         $multiplyconversion = $row['multiplyconversion'];
         $seqno = $row['seqno'];
         $reference_id = $row['reference_id'];
         $bpartner_id = $row['bpartner_id'];
         if ($reference_id > 0) {
             $reference_id = $refid;
         }
         $sqlinsert = "INSERT INTO {$this->tabletransaction} \r\n\t\t\t(document_no,\r\n\t\t\tbatch_id,\r\n\t\t\tamt,\r\n\t\t\toriginalamt,\r\n\t\t\ttax_id,\r\n\t\t\tcurrency_id,\r\n\t\t\tdocument_no2,\r\n\t\t\ttranstype,\r\n\t\t\taccounts_id,\r\n\t\t\tmultiplyconversion,\r\n\t\t\tseqno,\r\n\t\t\treference_id,\r\n\t\t\tbpartner_id) \r\n\r\n\t\t\tvalues \r\n\r\n\t\t\t(\"{$document_no}\",\r\n\t\t\t{$nextbatchid},\r\n\t\t\t{$amt},\r\n\t\t\t{$originalamt},\r\n\t\t\t{$tax_id},\r\n\t\t\t{$currency_id},\r\n\t\t\t\"{$document_no2}\",\r\n\t\t\t\"{$transtype}\",\r\n\t\t\t{$accounts_id},\r\n\t\t\t{$multiplyconversion},\r\n\t\t\t{$seqno},\r\n\t\t\t{$reference_id},\r\n\t\t\t{$bpartner_id})";
         $this->log->showLog(4, "Before insert reuse SQL:{$sqlinsert}");
         $rs = $this->xoopsDB->query($sqlinsert);
         if (!$rs) {
             $this->log->showLog(1, "Failed to insert reuse code {$batch_name}:" . mysql_error() . ":{$sqlinsert}");
             return false;
         }
         if ($reference_id == 0) {
             $refid = $this->getLatestTransID();
         }
     }
     return true;
 }
示例#5
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int studentpayment_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $studentpayment_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $previewctrl = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New";
            $action = "create";
            if ($studentpayment_id == 0) {
                $this->studentpayment_name = "";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $studentpaymentchecked = "CHECKED";
                $this->studentpayment_no = getNewCode($this->xoopsDB, "studentpayment_no", $this->tablestudentpayment, "");
                $this->studentpayment_date = getDateSession();
                $this->studentpayment_type = "C";
                $this->iscomplete = 0;
            }
            $savectrl = "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='studentpayment_id' value='{$this->studentpayment_id}' type='hidden'>" . "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablestudentpayment}' type='hidden'>" . "<input name='id' value='{$this->studentpayment_id}' type='hidden'>" . "<input name='idname' value='studentpayment_id' type='hidden'>" . "<input name='title' value='Studentpayment' type='hidden'>" . "<input name='btnView' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit";
            if ($this->allowDelete($this->studentpayment_id)) {
                $deletectrl = "<FORM action='studentpayment.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this studentpayment?"' . ")'><input type='submit' value='Delete' name='btnDelete'>" . "<input type='hidden' value='{$this->studentpayment_id}' name='studentpayment_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='studentpayment.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
            $previewctrl = "<FORM target='_blank' action='viewstudentpayment.php' method='POST' aonSubmit='return confirm(" . '"confirm to remove this studentpayment?"' . ")'><input type='submit' value='Preview' name='btnPreview'>" . "<input type='hidden' value='{$this->studentpayment_id}' name='studentpayment_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
        }
        $searchctrl = "<Form action='studentpayment.php' method='POST'>\r\n                            <input name='btnSearch' value='Search' type='submit'>\r\n                            <input name='action' value='search' type='hidden'>\r\n                            </form>";
        $selectInvoice = "";
        $selectOthers = "";
        $styleInvoice = "";
        $styleOthers = "";
        if ($this->studentpayment_category == "O") {
            $selectOthers = "SELECTED";
            if ($type != "new") {
                $styleInvoice = "style='display:none'";
            }
        } else {
            $selectInvoice = "SELECTED";
            if ($type != "new") {
                $styleOthers = "style='display:none'";
            }
        }
        $selectCash = "";
        $selectCheque = "";
        if ($this->studentpayment_type == "Q") {
            $selectCheque = "SELECTED";
        } else {
            $selectCash = "SELECTED";
        }
        if ($this->studentpayment_type == "C") {
            $stylecno = "style='display:none'";
        } else {
            $stylecno = "";
        }
        $this->stylecomplete = "style='display:none'";
        $this->styleenable = "style='display:none'";
        $this->stylesave = "style='display:none'";
        $submitform = "onsubmit='return validateStudentpayment()'";
        if ($type == "edit") {
            if ($this->iscomplete == 0) {
                $this->stylecomplete = "";
                $this->stylesave = "";
            } else {
                $this->styleenable = "";
                $submitform = "onsubmit='return false'";
            }
        } else {
            $this->stylesave = "";
        }
        echo <<<EOF


<table style="width:140px;">
<tbody>
<td>{$addnewctrl}</td>
<td>{$searchctrl}</td>
<td><form {$submitform} method="post"
 action="studentpayment.php" name="frmStudentpayment"  enctype="multipart/form-data"><input name="reset" value="Reset" type="reset"></td></tbody></table>

<input type="hidden" name="deletesubline_id" value="0">
<input type="hidden" name="deletenoteline_idss" value="0">
<input type="hidden" name="iscomplete" value="{$this->iscomplete}">
<input type="hidden" name="batch_id" value="{$this->batch_id}">

  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
        <tr>
        <th colspan="4" rowspan="1">{$header}</th>
        </tr>
        <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even">{$this->orgctrl}</td>
        <td class="head">Date {$mandatorysign}</td>
        <td class="even">
        <input name='studentpayment_date' id='studentpayment_date' value="{$this->studentpayment_date}" maxlength='10' size='10'>
        <input name='btnDate' value="Date" type="button" onclick="{$this->invoicedatectrl}"> <font color=red>YYYY-MM-DD (Ex: 2009-01-30)</font>
        </td>

        </tr>

        <tr style="display:none">
        <td class="head" style="display:none">Studentpayment Code {$mandatorysign}</td>
        <td class="even" style="display:none"></td>
        <td class="head">Studentpayment Name {$mandatorysign}</td>
        <td class="even" ><input maxlength="100" size="50" name="studentpayment_name" value="{$this->studentpayment_name}"></td>
        </tr>

        <tr>
        <td class="head">Payment Type</td>
        <td class="even" colspan="3">
        <select name="studentpayment_category">
        <option value="I" {$selectInvoice} {$styleInvoice}>By Invoice</option>
        <option value="O" {$selectOthers} {$styleOthers}>Others</option>
        </select>
        </td>
        </tr>

        <tr>
        <td class="head">Student</td>
        <td class="even">{$this->studentctrl}</td>
        <td class="head">Payment No</td>
        <td class="even"><input maxlength="30" size="15" name="studentpayment_no" value="{$this->studentpayment_no}"></td>
        </tr>

        <tr>
        <td class="head">Payment Method</td>
        <td class="even">
        <select name="studentpayment_type" onchange="changeMethod(this.value)">
        <option value="C" {$selectCash}>Cash</option>
        <option value="Q" {$selectCheque}>Cheque</option>
        </select>
        </td>
        <td class="head">Cheque No</td>
        <td class="even"><input {$stylecno} maxlength="10" size="10" name="studentpayment_chequeno" value="{$this->studentpayment_chequeno}"></td>
        </tr>

        <tr>
        <td class="head" style="display:none">From Account</td>
        <td class="even" style="display:none">{$this->fromaccountsctrl}</td>
        <td class="head">To Account</td>
        <td class="even" colspan="3">{$this->toaccountsctrl}</td>
        </tr>

        <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><textarea name="description" cols="40" rows="3">{$this->description}</textarea></td>
        </tr>
 
    </tbody>
  </table>
EOF;
        if ($type != "new") {
            $this->getAlertTable($this->student_id);
            $this->getSubTable($this->studentpayment_id);
        } else {
        }
        echo <<<EOF

<br>
<table astyle="width:150px;"><tbody><td width=1 {$this->stylesave}>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form>
    <td width=1>
    <input type="button" value="Complete" onclick="paymentComplete()" {$this->stylecomplete}>
    <input type="button" value="Re-Enable" onclick="paymentEnable()" {$this->styleenable}>
    </td>
    <td >{$previewctrl}</td>
    <td align="right" {$this->stylesave}>{$deletectrl}</td>
    </tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#6
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int student_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $student_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $styleviewdetails = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Student";
            $action = "create";
            $styleviewdetails = "display:none";
            if ($student_id == 0) {
                $checkedBumi = "CHECKED";
                $this->ishostel = 1;
                $this->student_name = "";
                $this->gender = "M";
                $this->marital_status = "S";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $this->total_loan = 0;
                $this->student_postpone = 0;
                $this->studentfather_salary = 0;
                $this->studentmother_salary = 0;
                $this->studenthier_salary = 0;
                $studentchecked = "CHECKED";
                $this->student_no = getNewCode($this->xoopsDB, "student_no", $this->tablestudent, "");
            }
            $savectrl = "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='student_id' value='{$this->student_id}' type='hidden'>" . "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $userfieldctrl = " Email: <input name='email' value='{$this->email}'>\r\n        <Input name='btnResetPassword' value='Reset Password' type='button'\r\n         onclick='resetpassword({$this->student_id})'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablestudent}' type='hidden'>" . "<input name='id' value='{$this->student_id}' type='hidden'>" . "<input name='idname' value='student_id' type='hidden'>" . "<input name='title' value='Student' type='hidden'>" . "<input name='btnRecord' value='View Record Info' type='submit'>" . "</form>";
            }
            //Not work in IE:
            //$ostctrl = "<a href='studentreminder.php?action=showReminder&student_id=$this->student_id'><input type='button' name='Outstandingbtn' value='OutStanding'></a>";
            $ostctrl = "<a href='studentreminder.php?action=showReminder&student_id={$this->student_id}'>Outstanding</a>";
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            if ($this->isuitmstudent == 1) {
                $checkedUitm = "CHECKED";
            } else {
                $checkedUitm = "";
            }
            if ($this->isbumiputerastudent == 1) {
                $checkedBumi = "CHECKED";
            } else {
                $checkedBumi = "";
            }
            $header = "Edit Student   ";
            if ($this->allowDelete($this->student_id)) {
                $deletectrl = "<FORM action='student.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this student?"' . ")'><input type='submit' value='Delete Student' name='btnDelete'>" . "<input type='hidden' value='{$this->student_id}' name='student_id'>" . "<input type='hidden' value='{$this->student_no}' name='student_no'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<input name='btnNew' value='New' type='button' onclick='gotoNew()'>";
            //$addnewctrl="<Form action='student.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
        }
        /*
           $searchctrl="<Form action='student.php' method='POST'>
                                   <input name='btnSearch' value='Search' type='submit'>
                                   <input name='action' value='search' type='hidden'>
                                   </form>";
        *
        */
        $searchctrl = "<input name='btnSearch' value='Search' type='button' onclick='gotoSearch()'>";
        $selectGenderM = "";
        $selectGenderF = "";
        if ($this->gender == "M") {
            $selectGenderM = "SELECTED";
        } else {
            $selectGenderF = "SELECTED";
        }
        $selectMaritalS = "";
        $selectMaritalM = "";
        if ($this->marital_status == "S") {
            $selectMaritalS = "SELECTED";
        } else {
            $selectMaritalM = "SELECTED";
        }
        $photourl = "";
        $icurl = "";
        $spmurl = "";
        if ($this->filephoto != "") {
            $photourl = "upload/student/{$this->filephoto}";
        }
        if ($this->fileic != "") {
            $icurl = "upload/student/{$this->fileic}";
        }
        if ($this->filespm != "") {
            $spmurl = "upload/student/{$this->filespm}";
        }
        $photoalert = "";
        if (!file_exists($photourl) || $photourl == "") {
            $photourl = "";
            $photoalert = "<font color='red'><b><u>Photo Not Available.</u></b></font>";
        }
        if (file_exists($icurl) && $icurl != "") {
            $viewic = "<a href='{$icurl}' target='blank'>View IC ({$icurl})</a>";
        } else {
            $viewic = "<b><font color='red'>No Attachment.</font></b>";
        }
        if (file_exists($spmurl) && $spmurl != "") {
            $viewspm = "<a href='{$spmurl}' target='blank'>View SPM ({$spmurl})</a>";
        } else {
            $viewspm = "<b><font color='red'>No Attachment.</font></b>";
        }
        if ($this->tab_id == "") {
            $this->tab_id = 0;
        }
        $styletab1 = "style='display:none'";
        $styletab2 = "style='display:none'";
        $styletab3 = "style='display:none'";
        $styletab4 = "style='display:none'";
        $styletblheader = "";
        $view_detailstxt = "View Details >>";
        $student_title = "{$this->student_name} ({$this->student_no}) - {$this->course_no}";
        if ($this->tab_id == 1) {
            $styletab1 = "";
            $styletblheader = "style='display:none'";
            $view_detailstxt = "View Header >>";
        } else {
            if ($this->tab_id == 2) {
                $styletab2 = "";
                $styletblheader = "style='display:none'";
                $view_detailstxt = "View Header >>";
            } else {
                if ($this->tab_id == 3) {
                    $styletab3 = "";
                    $styletblheader = "style='display:none'";
                    $view_detailstxt = "View Header >>";
                } else {
                    if ($this->tab_id == 4) {
                        $styletab4 = "";
                        $styletblheader = "style='display:none'";
                        $view_detailstxt = "View Header >>";
                    }
                }
            }
        }
        //echo   $styletblheader = "style='display:none'";
        $selecthostelY = "";
        $selecthostelN = "";
        if ($this->ishostel == 0) {
            $styletempaddress = "";
            $selecthostelN = "selected";
        } else {
            $styletempaddress = "style='display:none'";
            $selecthostelY = "selected";
        }
        $styleviewdetails = "display:none";
        echo <<<EOF


<form onsubmit="return validateStudent()" method="post"
 action="student.php" name="frmStudent" enctype="multipart/form-data">

<table style="width:100%;">
<tr><td align="left" width="1" nowrap>
<div id="txtViewID">Student Info >> </div>
</td>
<td align="left" nowrap id="idTDStudent">&nbsp;&nbsp;<font style="background-color: #c4d2f1"><a href="../hes/student.php?action=edit&student_id={$this->student_id}" target="_blank">{$student_title}</a></font></td>
</tr>
</table>
<br>

<div  id="idTab1" style="display:none">
EOF;
        $this->viewParentsTable();
        echo <<<EOF
</div>

<div  id="idTab2" style="display:none">
EOF;
        $this->viewSPMTable();
        echo <<<EOF
</div>

<div  id="idTab3">
EOF;
        $this->viewLoanTable();
        echo <<<EOF
</div>

<div  id="idTab4" style="display:none">
EOF;
        $this->viewDisciplineTable();
        echo <<<EOF
</div>

<div id="idTblHeader" {$styletblheader}>
<table style="width:140px;">
<tbody>
<td style="display:none"></td>
<td></td>

<td>


<input type="hidden" name="tab_id" value="{$this->tab_id}">

<input name="reset" value="Reset" type="reset" style="display:none"></td></tbody></tr></table>

    <input type="hidden" value="Update Semester Student" onclick="action.value='updatestudentsemester'" style="display:none">
  <table style="text-align: left; width: 100%;display:none" border="0" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" acolspan="3">{$this->orgctrl}&nbsp;Active <input type="checkbox" {$checked} name="isactive"></td>
\t\t\t<td class="head" astyle="display:none">Default Level {$mandatorysign}</td>
\t        <td class="even"  astyle="display:none"><input maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>
   \t
      </tr>

      <tr>
\t  \t<td class="head" astyle="display:none">Matrix No {$mandatorysign}<br><br>
        Student Name {$mandatorysign}<br><br>
        User Login</td>
        <td class="even" astyle="display:none">
        <input maxlength="10" size="10" name="student_no" value="{$this->student_no}"><br><br>
        <input maxlength="100" size="50" name="student_name" value="{$this->student_name}"><br><br>
        {$this->uidctrl}
       {$userfieldctrl}
        </td>
        <td class="head" colspan="2" arowspan="2" >

        <table>
        <tr height="100">
        <td style="background-color:gainsboro" align="center">
        <a href="{$photourl}" target="blank"><img src="{$photourl}" width="200" height="200"></a>{$photoalert}</td>
        </tr>
        <tr>
        <td><input type="file" name="filephoto">&nbsp;&nbsp;Remove Photo <input type="checkbox" name="deleteAttachmentPhoto" title="Choose it if you want to remove this Photo">
        <br>(200 x 200 : JPG Format only)
        </td>
        </tr>
        </table>
        
        </td>
      </tr>

      <tr>
        <td class="head">Course</td>
        <td class="even" >{$this->coursectrl}</td>
\t  \t<td class="head">Year / Session</td>
        <td class="even">{$this->yearctrl} {$this->sessionctrl}</td>
      </tr>

      <tr>
\t  \t<td class="head">Uitm Student</td>
        <td class="even"><input type="checkbox" {$checkedUitm} name="isuitmstudent"></td>
        <td class="head">Bumiputera</td>
        <td class="even" ><input type="checkbox" {$checkedBumi} name="isbumiputerastudent"></td>
      </tr>

      <tr>
\t  \t<td class="head">New IC No<br><br>Date Of Birth</td>
        <td class="even">
        <input maxlength="20" size="15" name="student_newicno" value="{$this->student_newicno}"> <font color=red>(Ex: 800130-01-5577)</font><br><br>
        <input name='student_dob' id='student_dob' value="{$this->student_dob}" maxlength='10' size='10'>
    \t<input name='btnDate' value="Date" type="button" onclick="{$this->dobdatectrl}"> <font color=red>YYYY-MM-DD (Ex: 1980-01-30)</font>
        </td>
        <td class="head">Old IC No</td>
        <td class="even" ><input maxlength="20" size="15" name="student_oldicno" value="{$this->student_oldicno}"></td>
      </tr>

     <tr>
        <td class="head">Races / Religion / Gender</td>
        <td class="even">
            {$this->racesctrl}
            {$this->religionctrl}
            <select name="gender">
            <option value="M" {$selectGenderM}>Male</option>
            <option value="F" {$selectGenderF}>Female</option>
            </select>
        </td>
\t  \t<td class="head">Marital Status</td>
        <td class="even">
            <select name="marital_status">
            <option value="S" {$selectMaritalS}>Single</option>
            <option value="M" {$selectMaritalM}>Married</option>
            </select>
        </td>
      </tr>


      <tr >
\t  \t<td class="head">Stay In Hostel?</td>
        <td class="even" colspan="3" valign="top">
        <select name="ishostel" onchange="viewTempAddress(this.value)">
        <option value=1 {$selecthostelY}>Hostel</option>
        <option value=0 {$selecthostelN}>Non Hostel</option>
        </select>
        </td>
      </tr>

      <tr id="idTempAddress" {$styletempaddress}>
\t  \t<td class="head">Temporary Address</td>
        <td class="even" colspan="3" valign="top">
        <textarea name="student_tempaddress" cols="40" rows="4">{$this->student_tempaddress}</textarea>
        </td>
      </tr>

      <tr >
\t  \t<td class="head">Address</td>
        <td class="even" colspan="3" valign="top">
        <textarea name="student_address" cols="40" rows="4">{$this->student_address}</textarea>
        </td>
      </tr>

      <tr>
\t  \t<td class="head">Postcode</td>
        <td class="even"><input maxlength="10" size="8" name="student_postcode" value="{$this->student_postcode}"></td>
        <td class="head">City</td>
        <td class="even" ><input maxlength="30" size="20" name="student_city" value="{$this->student_city}"></td>
      </tr>

      <tr>
\t  \t<td class="head">State</td>
        <td class="even"><input maxlength="20" size="20" name="student_state" value="{$this->student_state}"></td>
        <td class="head">Country</td>
        <td class="even" >{$this->countryctrl}</td>
      </tr>

      <tr>
\t  \t<td class="head">Home Tel No</td>
        <td class="even"><input maxlength="15" size="12" name="student_telno" value="{$this->student_telno}"></td>
        <td class="head">HP No {$mandatorysign}</td>
        <td class="even" ><input maxlength="15" size="12" name="student_hpno" value="{$this->student_hpno}"></td>
      </tr>

      <tr>
\t  \t<td class="head"><br>IC Attachment<br>( JPG Format only)<br><br>SPM Result Attachment<br>( JPG Format only)</td>
        <td class="even" acolspan="3">
        {$viewic}<br><input type="file" name="fileic">&nbsp;&nbsp;Remove IC <input type="checkbox" name="deleteAttachmentIc" title="Choose it if you want to remove this IC"><br><br>
         {$viewspm}<br><input type="file" name="filespm">&nbsp;&nbsp;Remove SPM <input type="checkbox" name="deleteAttachmentSpm" title="Choose it if you want to remove this SPM">
        </td>
        <td class="head">Year Of SPM<br><br>School</td>
        <td class="even" acolspan="3"><input maxlength="4" size="4" name="spm_year" value="{$this->spm_year}"><br><br>
        <input maxlength="50" size="30" name="spm_school" value="{$this->spm_school}">
        </td>
      </tr>

      <tr>
        <td class="head">Loan</td>
        <td class="even" >{$this->loantypectrl}</td>
\t  \t<td class="head">Total Loan (RM)</td>
        <td class="even"><input maxlength="12" size="10" name="total_loan" value="{$this->total_loan}"></td>
      </tr>

      <!--<tr>
\t  \t<td class="head">Year Of SPM<br><br>School</td>
        <td class="even" colspan="3"><input maxlength="4" size="4" name="spm_year" value="{$this->spm_year}"><br><br>
        <input maxlength="50" size="30" name="spm_school" value="{$this->spm_school}">
        </td>
      </tr>-->


      <tr>
        <td class="head">Remarks</td>
        <td class="even" colspan='3'><textarea name="description" cols="40" rows="3">{$this->description}</textarea></td>
      </tr>

      <tr>
        <td class="head">Postpone</td>
        <td class="even" colspan="3">
        <input maxlength="5" size="5" name="student_postpone" value="{$this->student_postpone}"><br>
        <textarea name="studentpostpone_remarks" cols="40" rows="5">{$this->studentpostpone_remarks}</textarea>
        </td>
      </tr>

        <tr>
        <th class="head" colspan="4"><input type="checkbox" name="createnewrecord"> Redirect To New Record?</th>
        </tr>


        </tbody>
        </table>
        <br>
        </div>



<table astyle="width:150px;" ><tbody><td>{$savectrl} 
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t<td align="center">{$searchctrl}</td>
        <td align="center">{$ostctrl}</td>
\t</tbody></table>
  <br>


</form>

<br>
<table style="width:100%;" ><tbody><tr><td align="left">{$recordctrl}</td><td style="display:none" align="right" id="tdDelete">{$deletectrl}</td></tr></tbody></table>
<br>


EOF;
    }
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type
     * @param int studentreminder_id
     * @return
     * @access public
     */
    public function getInputForm($type, $studentreminder_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $previewbtn = '';
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Student Reminder";
            $action = "create";
            if ($studentreminder_id == 0) {
                $this->isactive = "";
                $this->defaultlevel = 10;
                $this->studentreminder_id = getNewCode($this->xoopsDB, "studentreminder_id", $this->tablestudentreminder, "");
            }
            $savectrl = "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='studentreminder_id' value='{$this->studentreminder_id}' type='hidden'>" . "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablestudentreminder}' type='hidden'>" . "<input name='id' value='{$this->studentreminder_id}' type='hidden'>" . "<input name='idname' value='studentreminder_id' type='hidden'>" . "<input name='title' value='Student Reminder' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit Student Reminder";
            if ($this->allowDelete($this->studentreminder_id)) {
                $deletectrl = "<FORM action='studentreminder.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this student reminder?"' . ")'><input type='submit' value='Delete' name='submit'>" . "<input type='hidden' value='{$this->studentreminder_id}' name='studentreminder_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='studentreminder.php' method='POST'><input name='submit' value='New' type='submit'></form>";
            $previewbtn = '<a href="student_reminder.php?reminder_id=' . $this->studentreminder_id . '" target="blank"><input type="button" value="Preview Letter" name="preButton"></a>';
        }
        echo <<<EOF


<table style="width:140px;"><tbody><td>{$addnewctrl}</td><td><form onsubmit="return validateStudentReminder()" method="post"
 action="studentreminder.php" name="frmStudentReminder"><input name="reset" value="Reset" type="reset"></td>
<td><a href="studentreminder.php?action=search"><input type="button" value="Search Student Reminder" name="searchbutton"></a></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan="3">{$this->orgctrl}&nbsp;Active <input type="checkbox" {$checked} name="isactive"></td>
\t\t\t<td class="head" style="display:none">Default Level {$mandatorysign}</td>
\t        <td class="even"  style="display:none"><input maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>

      </tr>
      <tr>
\t<td class="head">Student </td>
        <td class="even" >{$this->studentctrl}</td>
        <td class="head">Semester</td>
        <td class="even">{$this->semesterctrl}</td>
      </tr>
      <tr>
        <td class="head">Reminder </td>
        <td class="even">{$this->reminderctrl}</td>
        <td class="head">Date</td>
        <td class="even"><input name='reminder_date' id='reminder_date' value="{$this->reminder_date}" maxlength='10' size='10'>
    <input name='btnDate' value="Date" type="button" onclick="{$this->reminderdatectrl}"> <font color=red>YYYY-MM-DD (Ex: 2009-12-30)</font></td>
      </tr>
      <tr>
        <td class="head">Remarks</td>
        <td class="even"  colspan="3"><textarea name="remarks" cols="40" rows="4">{$this->remarks}</textarea></td>
        
      </tr>

    </tbody>
  </table>
<table style="width:150px;"><tbody><td>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden">
        </td>
\t</form>
        
        <td>{$deletectrl}</td><td>{$previewbtn}</td></tbody></table>

  <br>

{$recordctrl}

EOF;
    }
示例#8
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int closing_id 
     * @return 
     * @access public
     */
    public function getInputForm($type, $closing_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $completectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Closing";
            $action = "create";
            if ($closing_id == 0) {
                $this->closing_no = getNewCode($this->xoopsDB, "closing_no", $this->tableclosing);
                //$this->closing_name="";
                $this->isactive = "";
                $this->iscomplete = "";
            }
            $savectrl = "<input style='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='closing_id' value='{$this->closing_id}' type='hidden'>" . "<input style='height: 40px;' name='btnSave' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$tableclosing}' type='hidden'>" . "<input name='id' value='{$this->closing_id}' type='hidden'>" . "<input name='idname' value='closing_id' type='hidden'>" . "<input name='title' value='Closing' type='hidden'>" . "<input name='btnRecord' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            if ($this->iscomplete == 1) {
                $checked2 = "CHECKED";
            } else {
                $checked2 = "";
            }
            $header = "Edit Closing";
            if ($this->allowDelete($this->closing_id)) {
                $deletectrl = "<FORM action='closing.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this closing?"' . ")'><input type='submit' value='Delete' name='btnDelete' style='height: 40px;'>" . "<input type='hidden' value='{$this->closing_id}' name='closing_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='closing.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
        }
        $addnewctrl = "<a href='closing.php'>[ Add New ]</a><a href='closing.php?action=showsearchform'>[ Search ]</a>";
        $completectrl = "<input type='button' value='Complete' name='btnComplete' style='height: 40px;' onclick='completeRecord();'>";
        echo <<<EOF
<table style="width:140px;"><tbody><td nowrap>{$addnewctrl}</td><td><form onsubmit="return validateClosing()" method="post"
 action="closing.php" name="frmClosing"></td>
<tr>
<td><input name="reset" value="Reset" type="reset"></td>
</tr>
</tbody></table>

  <table style="text-align: left; width: 100%;" border="1" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan="3">{$this->orgctrl}</td>
 
      </tr>
      <tr>
\t<td class="head">Closing No {$mandatorysign}</td>
        <td class="odd"><input name="closing_no" size="10" maxlength="10" value="{$this->closing_no}"></td>
        <td class="head">Closing Period {$mandatorysign}</td>
        <td class="odd">{$this->periodctrl}
\t\t&nbsp;Active <input type="checkbox" {$checked} name="isactive">
\t\t<div style="display:none">&nbsp;Complete <input type="checkbox" {$checked2} name="iscomplete" ></div>
   \t
\t</td>
      </tr>
      <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><input maxlength="70" size="50" name="closing_description" value="{$this->closing_description}"></td>
      </tr>
 
    </tbody>
  </table>
<table style="width:150px;"><tbody><td>{$savectrl} 
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form><td>{$completectrl}</td><td>{$deletectrl}</td></tbody></table>
  <br>

{$recordctrl}

EOF;
    }
 public function createInvoice($year_id, $session_id, $student_id, $semester_id)
 {
     global $defaultorganization_id;
     $timestamp = date("y/m/d H:i:s", time());
     $studentinvoice_no = getNewCode($this->xoopsDB, "studentinvoice_no", $this->tablestudentinvoice, "");
     $sql = "insert into {$this->tablestudentinvoice}\r\n                    (studentinvoice_no,studentinvoice_date,student_id,\r\n                    semester_id,generatestudentinvoice_id,\r\n                    year_id,session_id,created,createdby,updated,updatedby,organization_id)\r\n                    values\r\n                    ('{$studentinvoice_no}','{$timestamp}',{$student_id},\r\n                    {$semester_id},{$this->generatestudentinvoice_id},{$year_id},{$session_id},'{$timestamp}',{$this->updatedby},'{$timestamp}',{$this->updatedby},{$defaultorganization_id})";
     $query = $this->xoopsDB->query($sql);
     if (!$query) {
         $this->txtwarning = "Cannot Create Invoice";
         return false;
     } else {
         $this->studentinvoice_id = getLatestPrimaryID("{$this->tablestudentinvoice}", "studentinvoice_id", true);
         return true;
     }
 }
示例#10
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type
     * @param int bpartner_id
     * @return
     * @access public
     */
    public function getInputForm($type, $bpartner_id, $token)
    {
        global $havewriteperm, $showOrganization, $isadmin;
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Business Partner";
            $action = "create";
            if ($bpartner_id == 0) {
                $this->bpartner_name = "";
                $this->isactive = 1;
                $this->seqno = 10;
                $this->employeecount = 0;
                $this->currentpurchasecreditstatus = 0;
                $this->currentbalance = 0;
                $this->currentsalescreditstatus = 0;
                $this->salescreditlimit = 0;
                $this->purchasecreditlimit = 0;
            }
            $savectrl = "<input style='height: 40px;' name='submit' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
            $this->bpartner_no = getNewCode($this->xoopsDB, "bpartner_no", $this->tablebpartner);
        }
        if ($havewriteperm == 1) {
            //user with write permission can edit data, have button
            $savectrl = "<input astyle='height: 40px;' name='btnsubmit' value='Save and Add More Details' type='button' onclick='validateBPartner()'>";
            $saveandnewctrl = "<input astyle='height: 80px;' name='btnsaveonly' value='Save and Add New' type='submit' onclick='saveonly();validateBPartner();'>";
        } else {
            //user dun have write permission, cannot save grid
            $savectrl = "";
            $saveandnewctrl = "";
            $noperm = "<div>You No Have Write Permission</div>";
        }
        $search_button = $this->getFormButton("Search", "bpartner.php", array("action" => "search"));
        $new_button = $this->getFormButton("New", "bpartner.php");
        if ($showOrganization != 1) {
            $hideOganization = "style='display:none'";
        } else {
            $hideOganization = "";
        }
        echo $this->searchAToZforDetail();
        echo <<<EOF
<script type='text/javascript'>
    function showAccountParameter(){
        var trAccountParameter=document.getElementById("trAccountParameter");
        var btnShowAccountParameter=document.getElementById("btnShowAccountParameter");
        if(trAccountParameter.style.display=="none"){
            trAccountParameter.style.display="";
            btnShowAccountParameter.value="Hide Account Info";
        }
        else{
            trAccountParameter.style.display="none";
            btnShowAccountParameter.value="Display Account Info";
        }
    }
   function saveonly()
   {
    document.getElementById("isaddnew").value=1;
   }

     function validateBPartner(){

     if(confirm("Confirm to save record?")){
         //start form validation
            var bpartner_no = document.getElementById('bpartner_no').value;
            var bpartner_name = document.getElementById('bpartner_name').value;
            var bpartnergroup_id = document.getElementById('bpartnergroup_id').value;

//            \$("#bpartner_no").removeClass('validatefail');
//            \$("#bpartner_name").removeClass('validatefail');
//            \$("#bpartnergroup_id").removeClass('validatefail');

            var isallow = true;
            var errorMsg = "";
            if(bpartner_no == ""){
                isallow = false;
                errorMsg += "<br/><b>Business Partner No </b>";
//                         \$("#bpartner_no").addClass('validatefail');
            }

            if(bpartner_name == ""){
                isallow = false;
                errorMsg += "<br/><b>Business Partner Name</b>";
//                         \$("#bpartner_name").addClass('validatefail');
            }

            if(bpartnergroup_id == "0" || bpartnergroup_id == ""){
                isallow = false;
                errorMsg += "<br/><b>Business Partner Group</b>";
//                         \$("#bpartnergroup_id").addClass('validatefail');
            }

             if(isallow){
             document.frmBPartner.submit();
              }else{
                 document.getElementById("statusDiv").innerHTML="Failed to save record...Please Check :<br/>"+errorMsg;
                 return false;
               }
         }
         else
         return false;
     }

</script>

 <div id="statusDiv" align="center" class="ErrorstatusDiv">{$noperm}</div>
   <table style="width: 970px;"  align="center">
    <tr>
       <td width="60px">{$search_button}</td>
       <td align="left">{$new_button}</td>
    </tr>
  </table>
<form method="post" action="bpartner.php" name="frmBPartner" id="frmBPartner" enctype="multipart/form-data" onsubmit="return false">
<input type="hidden" name="action" value="create">
<input type="hidden" name="mode" value="save">
<input type="hidden" name="isaddnew" id="isaddnew" value="0">
<input type="hidden" name="bpartner_id" value="0">

  <table style="text-align:left; width:970px;" align="center" border="0" cellpadding="0" cellspacing="1" >

      <tr>
        <td colspan="4" rowspan="1" class="searchformheader">{$header}</td>
      </tr>

      <tr><td class="searchformblock">
        <table >

      <tr {$hideOganization}>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" >{$this->orgctrl}</td>

      </tr>

      <tr>
       <td class="head">Business Partner No {$mandatorysign}</td>
        <td class="even" ><input maxlength="10" size="10" name="bpartner_no" id="bpartner_no" value="{$this->bpartner_no}">
\t&nbsp;Active <input type="checkbox" {$checked} name="isactive" id="isactive"> Default Level {$mandatorysign} <input maxlength="3" size="3" name='seqno' value='{$this->seqno}'>
   \t<td class="head">Business Partner Group {$mandatorysign}</td>
          <td class="even" >
            <select name="bpartnergroup_id" id="bpartnergroup_id">
               {$this->bpartnergroupctrl}
            </select></td>
      </tr>

      <tr>
    \t<td class="head">Company No</td>
\t    <td class="even" ><input name="companyno" id="companyno" value="{$this->companyno}"></td>
        <td class="head">Business Partner Name {$mandatorysign}</td>
          <td class="even" ><input maxlength="70" size="45" name="bpartner_name" id="bpartner_name" value="{$this->bpartner_name}"></td>
      </tr>

      <tr>
        <td class="head">Alternate Name</td>
\t    <td class="even" ><input name="alternatename" id="alternatename" value="{$this->alternatename}"></td>
        <td class="head">Employee Count</td>
\t    <td class="even" ><input name="employeecount" id="employeecount" value="{$this->employeecount}"></td>
      </tr>

      <tr>
    \t<td class="head">Industry</td>
\t    <td class="even" >
             <select name="industry_id" id="industry_id">
            {$this->industryctrl}
             </select>
            </td>
    \t<td class="head">User Group</td>
\t    <td class="even" >
             <select name="groupid" id="groupid">
            {$this->groupctrl}
             </select>
            </td>
      </tr>

     <tr>
    \t<td><br></td>
     </tr>

     <tr>
    \t<td class="head">Is Debtor (Customer)</td>
\t    <td class="even" ><input type="checkbox" name="isdebtor" id="isdebtor" {$isdebtorchecked}></td>
        <td class="head">Is Creditor (Supplier)</td>
\t    <td class="even" ><input type="checkbox" name="iscreditor" id="iscreditor" {$iscreditorchecked}></td>
      </tr>
     <tr>
    \t<td class="head">Is Transporter</td>
\t    <td class="even" ><input type="checkbox" name="istransporter" id="istransporter" {$istransporterchecked}></td>
        <td class="head">Is Dealer</td>
\t    <td class="even" ><input type="checkbox" name="isdealer" id="isdealer" {$isdealerchecked}></td>
      </tr>
     <tr>
    \t<td class="head">Is Prospect</td>
\t    <td class="even" ><input type="checkbox" name="isprospect" id="isprospect" {$isprospectchecked}></td>
           <td class="head">Currency</td>
        <td class="even" colspan="3"><select name="currency_id" id="currency_id">{$this->currencyctrl}</select > {$this->pricelistctrl}</td>
      </tr>

       <tr>
    \t<td><br></td>
      </tr>


       <tr>
        <td class="head">Tooltips</td>
\t    <td class="even"><input name="tooltips" id="tooltips" value="{$this->tooltips}" size="45"></td>
        <td class="head">Website</td>
\t    <td class="even"><input name="bpartner_url" id="bpartner_url" value="{$this->bpartner_url}" size="45"></td>
      </tr>

      <tr>
       <td class="head">In Charge Person</td>
\t    <td class="even"><input name="inchargeperson" id="inchargeperson" value="{$this->inchargeperson} " size="45"></td>
       <td class="head">Short Description</td>
            <td class="even"><input name="shortremarks" id="shortremarks" value="{$this->shortremarks}" size="45"></td>
      </tr>

      <tr>
        <td class="head" rowspan="3">Description</td>
\t    <td class="even" rowspan="3"><textarea cols="42" rows="3" name="description" id="description">{$this->description}</textarea></td>
      </tr>
            
      <tr>
        <td class="head" >AVL</td>
\t    <td class="even">{$this->purchasepricelistctrl}</td>
      </tr>
            
      <tr>
        <td class="head" >Sales Price List</td>
\t    <td class="even">{$this->salespricelistctrl}</td>
      </tr>

           <tr><td><br></td></tr>

          <tr><td class="searchformheader" colspan="4">Accounting Parameter:</td></tr>

           <tr>
            <td class="head">Debtor Account</td>
\t        <td class="even" id="iddebtoraccountsctrl">{$this->debtoraccountsctrl}<input type="hidden" name="previousaccounts_id" value="{$this->debtoraccounts_id}"></td>
            <td class="head">Creditor Account</td>
\t        <td class="even" id="idcreditoraccountsctrl">{$this->creditoraccountsctrl}<input type="hidden" name="previousaccounts_id" value="{$this->creditoraccounts_id}"></td>
           </tr>
           <tr>
            <td class="head">Sales Credit Limit</td>
\t        <td class="even"><input name="salescreditlimit" value="{$this->salescreditlimit}"></td>
            <td class="head">Purchase Credit Limit</td>
\t        <td class="even"><input name="purchasecreditlimit" value="{$this->purchasecreditlimit}"></td>
           </tr>
           <tr>
            <td class="head">Control Sales Credit Limit</td>
\t        <td class="even"><input type="checkbox" name="enforcesalescreditlimit" {$enforcesalescreditlimitchecked}></td>
            <td class="head">Control Purchase Credit Limit</td>
\t        <td class="even"><input type="checkbox" name="enforcepurchasecreditlimit" {$enforcepurchasecreditlimitchecked}></td>
           </tr>
           <tr>
            <td class="head">Current Sales Limit Status</td>
\t        <td class="even"><input name="currentsalescreditstatus" value="{$this->currentsalescreditstatus}"></td>
            <td class="head">Current Purchase Limit Status</td>
\t        <td class="even"><input name="currentpurchasecreditstatus" value="{$this->currentpurchasecreditstatus}"></td>
           </tr>
           <tr>
          <td class="head">Terms</td>
\t    <td class="even" >
               <select name="terms_id" id="terms_id>
                  {$this->termsctrl}
               </select></td>
            <td class="head">Bank Name</td>
\t        <td class="even"><input name="bankname" value="{$this->bankname}"></td>
           </tr>
           <tr>
            <td class="head">Bank Account Name</td>
\t        <td class="even"><input name="bankaccountname" value="{$this->bankaccountname}"></td>
            <td class="head">Bank Account No</td>
\t        <td class="even"><input name="bankaccountno" value="{$this->bankaccountno}"></td>
           </tr>

      <tr><td align="left" colspan="4"><br>{$savectrl} {$saveandnewctrl}</td>
              \t<td class="head"></td>
       </tr>

      </table>
      </td></tr>

  </table>
</form>

EOF;
    }
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int paymentvoucher_id 
     * @return 
     * @access public
     */
    public function getInputForm($type, $paymentvoucher_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Payment Voucher";
            $action = "create";
            if ($paymentvoucher_id == 0) {
                $this->paidto = "";
                $this->iscomplete = "";
                $this->exchangerate = 1;
                $this->amt = 0;
                $this->displaychequenostyle = "style='display:none'";
                $this->originalamt = 0;
                $this->iscomplete = 0;
                $this->paymentvoucher_no = getNewCode($this->xoopsDB, "paymentvoucher_no", $this->tablepaymentvoucher);
                //$this->paymentvoucher_date=date('Y-m-d',time());
                $this->paymentvoucher_date = getDateSession();
                $this->batch_id = 0;
            }
            $savectrl = "<input style='height: 40px;' name='submit' value='Save' type='submit'  onclick='iscomplete.value=0'>";
            $completectrl = "<input style='height: 40px;' name='submit' value='Complete' type='submit' onclick='iscomplete.value=1'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
            $closectrl = "";
        } else {
            $action = "update";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablepaymentvoucher}' type='hidden'>" . "<input name='id' value='{$this->paymentvoucher_id}' type='hidden'>" . "<input name='idname' value='paymentvoucher_id' type='hidden'>" . "<input name='title' value='Financial Year' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
            }
            $previewctrl = "<form target='_blank' action='viewpaymentvoucher.php' method='POST'>" . "<input name='paymentvoucher_id' value='{$this->paymentvoucher_id}' type='hidden'>" . "<input name='submit' value='Print Preview' type='submit'>" . "</form>";
            $princhequectrl = "<form target='_blank' action='viewprintcheque.php' method='POST' name='frmPrintCheque'>" . "<input name='paymentvoucher_id' value='{$this->paymentvoucher_id}' type='hidden'>" . "<input name='submit' value='Print Cheque' type='submit' id='btnPrintCheque' {$this->displaychequenostyle}>" . "</form>";
            $header = "Edit Payment Voucher";
            if ($this->iscomplete == 0) {
                $deletectrl = "<FORM action='paymentvoucher.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this paymentvoucher?"' . ")'><input type='submit' value='Delete' name='submit'>" . "<input type='hidden' value='{$this->paymentvoucher_id}' name='paymentvoucher_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
                $savectrl = "<input name='paymentvoucher_id' value='{$this->paymentvoucher_id}' type='hidden'>" . "<input style='height: 40px;' name='submit' value='Save' type='submit' onclick='iscomplete.value=0'>";
                $completectrl = "<input style='height: 40px;' name='submit' value='Complete' type='submit' onclick='iscomplete.value=1'>";
            } else {
                $deletectrl = "";
                $savectrl = "";
                $completectrl = "";
                if ($this->isAdmin) {
                    $activatectrl = "<FORM action='paymentvoucher.php' method='POST' onSubmit='return confirm(" . '"confirm to reactivate this paymentvoucher?"' . ")'><input type='submit' value='Reactivate' name='submit'>" . "<input type='hidden' value='{$this->paymentvoucher_id}' name='paymentvoucher_id'>" . "<input type='hidden' value='reactivate' name='action'><input name='token' value='{$token}' type='hidden'></form>";
                }
            }
            if ($this->batch_id > 0) {
                $viewbatch = "<a href='batch.php?batch_id={$this->batch_id}&action=edit'>View Journal</a>";
            } else {
                $viewbatch = "";
            }
        }
        if ($this->bpartner_id == 0) {
            $bpartner_fld = "<input type='hidden' name='bpartner_id' value='0'>";
        }
        echo <<<EOF
<A href='paymentvoucher.php'>[Add New]</A>&nbsp;<A href='paymentvoucher.php?action=showSearchForm'>[Search]</A>

<form onsubmit="return validatePaymentVoucher()" method="post" action="paymentvoucher.php" name="frmPaymentVoucher">
<table style="width:140px;"><tbody><td><input name="reset" value="Reset" type="reset"></td></tbody></table>
<div id="bpartnerID">{$bpartner_fld}</div>

  <table style="text-align: left; width: 100%;" border="1" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan='3'>{$this->orgctrl} {$viewbatch}</td>
\t</tr><tr>
   \t<td class="head">Date </td>
        <td class="even" ><input name="paymentvoucher_date" value="{$this->paymentvoucher_date}" id='paymentvoucher_date' size='10' maxlength='10'>
\t\t<input name="btnDate" value="Date" id='btnDate'  onclick="{$this->showCalendar}" type='button'></td>

   \t<td class="head">Payment Voucher No </td>
        <td class="even" ><input name="paymentvoucher_no" value="{$this->paymentvoucher_no}">
\t\t<input name="iscomplete" value="{$this->iscomplete}" type='hidden'></td>
      </tr>
      <tr>
     
        <td class="head">To Accounts</td>
        <td class="even">{$this->accountstoctrl} <div id='divbpartner'> {$this->bpartnerctrl}</div> 
\t\t\t<input name='bpartner_id_bc' id='bpartner_id_bc' type='hidden' value="{$this->bpartner_id_bc}"></td>
        <td class="head">Paid To</td>
        <td class="even"><input name='paidto' value="{$this->paidto}"></td>
      </tr>
      <tr>
        <td class="head">Currency</td>
        <td class="even">{$this->currencyctrl}</td>
        <td class="head">Exchange Rate</td>
        <td class="even"><input name='exchangerate' value="{$this->exchangerate}" onchange='amt.value=parseFloat(this.value*originalamt.value).toFixed(2)'></td>
      </tr>
      <tr>
        <td class="head">Amount</td>
        <td class="even"><input name='originalamt' value="{$this->originalamt}" onchange='amt.value=parseFloat(exchangerate.value*this.value).toFixed(2)'></td>
        <td class="head">Coverted Amount</td>
        <td class="even"><input name='amt' value="{$this->amt}" readonly='readonly'></td>
      </tr>

      <tr>
   <td class="head">From Accounts</td>
        <td class="even">{$this->accountsfromctrl} <input value="{$this->chequeno}" name='chequeno' {$this->displaychequenostyle}>
\t\t</td>
        <td class="head">Received By</td>
        <td class="even"><input name='receivedby' value="{$this->receivedby}">
\t<input name='batch_id' value="{$this->batch_id}" type='hidden'></td>
      </tr>
      <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><textarea cols='70' name='description' >{$this->description}</textarea></td>
      </tr>
 <tr>
        <td class="head">Add New Record</td>
        <td class="even" colspan='3'><input type='checkbox' name='chkAddNew'> Add new record immediately after save or complete.</td>
      </tr>
    </tbody>
  </table>
<table style="width:150px;"><tbody><td>{$savectrl} </td><td>{$completectrl}</td>
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</tbody>
\t<table></form>

\t<table style="width:150px;">
\t<td>{$deletectrl} {$activatectrl}</td><td>{$recordctrl}</td><td>{$previewctrl}</td><td>{$princhequectrl}</td></table>
  <br>



EOF;
    }
示例#12
0
 public function PostBatch($uid, $date, $systemname, $batch_name, $description, $totaltransactionamt, $documentnoarray, $accountsarray, $amtarray, $currencyarray, $conversionarray, $originalamtarray, $bpartnerarray, $transtypearray, $linetypearray, $chequenoarray, $linedesc = "", $isreadonly = 0, $batchno = "", $orgarray, $track1array, $track2array, $track3array)
 {
     include_once "../simbiz/class/Batch.php";
     include_once "../simbiz/class/Accounts.php";
     include_once "../simbiz/class/Transaction.php";
     include_once "../simbiz/class/FinancialYearLine.php";
     include_once "../simantz/class/Period.inc.php";
     //		include_once "system.php";
     global $xoopsDB, $log, $defaultorganization_id, $tableprefix;
     $tablebatch = $tableprefix . "simbiz_batch";
     $tabletransaction = $tableprefix . "simbiz_transaction";
     $batch = new Batch();
     $acc = new Accounts();
     $trans = new Transaction();
     $fyl = new FinancialYearLine();
     $period = new Period();
     $year = $this->left($date, 4);
     $month = $this->right($this->left($date, 7), 2);
     $period_id = $period->getPeriodID($year, $month);
     $allowtrans = $fyl->allowAccountTransactionInDate($defaultorganization_id, $date);
     if (!$allowtrans) {
         $log->showLog(1, "Can't post data due to period in financial year is closed. You can fix this problem on re-opened this period at Financial Year window(under simbiz module)");
         return false;
     }
     $totaltransactionamt = abs($totaltransactionamt);
     //1.get next batch no
     if ($batchno == "") {
         $batchno = getNewCode($xoopsDB, "batchno", $tablebatch);
     }
     $timestamp = date("y/m/d H:i:s", time());
     //2. Create new batch
     $sqlinsertbatch = "INSERT INTO {$tablebatch} (organization_id, batchno,batch_name,description,created,createdby,\r\n\t\t\tupdated,updatedby,totaldebit,totalcredit,fromsys,batchdate,iscomplete,isreadonly,period_id) values(\r\n\t\t\t{$defaultorganization_id}, '{$batchno}','{$batch_name}','{$description}','{$timestamp}',{$uid},\r\n\t\t\t'{$timestamp}',{$uid},{$totaltransactionamt},{$totaltransactionamt},'{$systemname}','{$date}',1,{$isreadonly},{$period_id})";
     $rsinsertbatch = $xoopsDB->query($sqlinsertbatch);
     if (!$rsinsertbatch) {
         $log->showLog(1, __LINE__ . "PostBatch Create batch failed with sqlinsertbatch: {$sqlinsertbatch} ");
         return false;
     } else {
         $log->showLog(4, "Create batch successfully with sqlinsertbatch: {$sqlinsertbatch} ");
         $newbatch_id = $batch->getLatestBatchID();
         $i = 0;
         $reference_id = 0;
         foreach ($accountsarray as $accounts_id) {
             //3. Loop to create transaction
             if ($i != 0 && ($i == 1 || $linetypearray[$i - 1] == 0)) {
                 $reference_id = $this->latestTransactionId();
             } elseif ($linetypearray[$i] == 0 && $i > 0) {
                 $reference_id = 0;
             }
             if ($orgarray[$i] == "") {
                 $orgarray[$i] == $defaultorganization_id;
             }
             if ($track1array[$i] == "") {
                 $track1array[$i] = 0;
             }
             if ($track2array[$i] == "") {
                 $track2array[$i] = 0;
             }
             if ($track3array[$i] == "") {
                 $track3array[$i] = 0;
             }
             $sqlinserttransaction = "INSERT INTO {$tabletransaction} (\r\n\t\t\t\t\tdocument_no,batch_id,amt,currency_id,originalamt,\r\n\t\t\t\t\ttranstype,accounts_id,multiplyconversion,\r\n\t\t\t\t\tseqno,reference_id,bpartner_id,document_no2,linedesc,branch_id,track_id1,track_id2,track_id3)\r\n\t\t\t\t\tVALUES (\r\n\t\t\t\t\t'{$documentnoarray[$i]}',{$newbatch_id},{$amtarray[$i]},{$currencyarray[$i]},{$originalamtarray[$i]},\r\n\t\t\t\t\t'{$transtypearray[$i]}',{$accounts_id},{$conversionarray[$i]},'{$i}',{$reference_id},{$bpartnerarray[$i]},\r\n\t\t\t\t\t'{$chequenoarray[$i]}','{$linedesc[$i]}', {$orgarray[$i]},{$track1array[$i]},{$track2array[$i]},{$track3array[$i]})";
             $rsinserttransaction = $xoopsDB->query($sqlinserttransaction);
             if (!$rsinserttransaction) {
                 echo mysql_error();
                 $log->showLog(1, __LINE__ . "PostBatch Create transaction line failed with\r\n\t\t\t\t\t\t\t sqlinserttransaction: {$sqlinserttransaction},<br>deleteing batch: {$newbatch_id}");
                 $batch->deleteBatch($newbatch_id);
                 return false;
             } else {
                 $log->showLog(4, __LINE__ . "PostBatch Create transaction line successfully with\r\n\t\t\t\t\t\t\t sqlinserttransaction: {$sqlinserttransaction} ");
             }
             $i++;
         }
         //4. update lastbalance for accounts, and parent accounts
         $trans->compileSummary($newbatch_id);
         //5. Update transaction summary
         //6. update last balance for bpartner
         $trans->insertTransactionSummary($newbatch_id, $defaultorganization_id, 1);
         //7. put batch id, batch no at resultbatch_id,$resultbatch_no
         $this->resultbatch_id = $newbatch_id;
         $this->resultbatch_no = $batchno;
         //return true or false
         //$acc->repairAccounts();
         return true;
     }
     return false;
 }
示例#13
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int courseinvoice_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $courseinvoice_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New";
            $action = "create";
            if ($courseinvoice_id == 0) {
                $this->courseinvoice_name = "";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $courseinvoicechecked = "CHECKED";
                $this->courseinvoice_no = getNewCode($this->xoopsDB, "courseinvoice_no", $this->tablecourseinvoice, "");
            }
            $savectrl = "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='courseinvoice_id' value='{$this->courseinvoice_id}' type='hidden'>" . "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablecourseinvoice}' type='hidden'>" . "<input name='id' value='{$this->courseinvoice_id}' type='hidden'>" . "<input name='idname' value='courseinvoice_id' type='hidden'>" . "<input name='title' value='Courseinvoice' type='hidden'>" . "<input name='btnView' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit";
            if ($this->allowDelete($this->courseinvoice_id)) {
                $deletectrl = "<FORM action='courseinvoice.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this courseinvoice?"' . ")'><input type='submit' value='Delete' name='btnDelete'>" . "<input type='hidden' value='{$this->courseinvoice_id}' name='courseinvoice_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='courseinvoice.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
        }
        $searchctrl = "<Form action='courseinvoice.php' method='POST'>\r\n                            <input name='btnSearch' value='Search' type='submit'>\r\n                            <input name='action' value='search' type='hidden'>\r\n                            </form>";
        $selectS = "";
        $selectQ = "";
        $selectP = "";
        $selectL = "";
        if ($this->courseinvoice_category == "S") {
            $selectS = "SELECTED";
        } else {
            if ($this->courseinvoice_category == "Q") {
                $selectQ = "SELECTED";
            } else {
                if ($this->courseinvoice_category == "P") {
                    $selectP = "SELECTED";
                } else {
                    if ($this->courseinvoice_category == "L") {
                        $selectL = "SELECTED";
                    }
                }
            }
        }
        echo <<<EOF


<table style="width:140px;">
<tbody>
<td>{$addnewctrl}</td>
<td>{$searchctrl}</td>
<td><form onsubmit="return validateCourseinvoice()" method="post"
 action="courseinvoice.php" name="frmCourseinvoice"  enctype="multipart/form-data"><input name="reset" value="Reset" type="reset"></td></tbody></table>

<input type="hidden" name="deletesubline_id" value="0">
<input type="hidden" name="deletenoteline_idss" value="0">

  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
        <tr>
        <th colspan="4" rowspan="1">{$header}</th>
        </tr>
        <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan="3">{$this->orgctrl}&nbsp;Active <input type="checkbox" {$checked} name="isactive"></td>
        <td class="head" style="display:none">Default Level {$mandatorysign}</td>
        <td class="even"  style="display:none"><input maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>

        </tr>

        <tr style="display:none">
        <td class="head" style="display:none">Courseinvoice Code {$mandatorysign}</td>
        <td class="even" style="display:none"><input maxlength="30" size="15" name="courseinvoice_no" value="{$this->courseinvoice_no}"></td>
        <td class="head">Courseinvoice Name {$mandatorysign}</td>
        <td class="even" ><input maxlength="100" size="50" name="courseinvoice_name" value="{$this->courseinvoice_name}"></td>
        </tr>

        <tr>
        <td class="head">Course</td>
        <td class="even" colspan="3">{$this->coursectrl}</td>
        </tr>

        <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><textarea name="description" cols="60" rows="10">{$this->description}</textarea></td>
        </tr>
 
    </tbody>
  </table>
EOF;
        if ($type != "new") {
            $this->getSubTable($this->courseinvoice_id);
        }
        echo <<<EOF

<br>
<table style="width:150px;"><tbody><td>{$savectrl} 
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form><td>{$deletectrl}</td></tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#14
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int overtime_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $overtime_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $previewctrl = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New";
            $action = "create";
            if ($overtime_id == 0) {
                $this->overtime_name = "";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $overtimechecked = "CHECKED";
                $this->overtime_no = getNewCode($this->xoopsDB, "overtime_no", $this->tableovertime, "");
                $this->overtimeline_date = getDateSession();
            }
            $savectrl = "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='overtimeline_id' value='{$this->overtimeline_id}' type='hidden'>" . "<input astyle='height: 40px;' name='btnSave' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tableovertimeline}' type='hidden'>" . "<input name='id' value='{$this->overtimeline_id}' type='hidden'>" . "<input name='idname' value='overtimeline_id' type='hidden'>" . "<input name='title' value='Overtime' type='hidden'>" . "<input name='btnView' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit";
            if ($this->allowDelete($this->overtime_id)) {
                $deletectrl = "<FORM action='overtime.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this overtime?"' . ")'><input type='submit' value='Delete' name='btnDelete'>" . "<input type='hidden' value='{$this->overtimeline_id}' name='overtimeline_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='overtime.php' method='POST'><input name='btnNew' value='New' type='submit'></form>";
            $previewctrl = "<FORM target='_blank' action='../system/class/XMLParameter.php' method='POST' aonSubmit='return confirm(" . '"confirm to remove this overtime?"' . ")'><input type='submit' value='Preview' name='btnPreview'>" . "<input type='hidden' value='{$this->overtime_id}' name='fld_value'>" . "<input type='hidden' value='overtime_id' name='fld_name'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
        }
        $searchctrl = "<Form action='overtime.php' method='POST'>\r\n                            <input name='btnSearch' value='Search' type='submit'>\r\n                            <input name='action' value='search' type='hidden'>\r\n                            </form>";
        $stylesave = "";
        if ($this->overtime_id > 0) {
            $stylesave = "style='display:none'";
        }
        $styletimehours = "";
        if ($this->overtimeline_type == "T") {
            $styletimehours = "style='display:none'";
        }
        echo <<<EOF


<table style="width:140px;">
<tbody>
<td>{$addnewctrl}</td>
<td>{$searchctrl}</td>
<td><form onsubmit="return validateOvertime()" method="post"
 action="overtime.php" name="frmOvertime"  enctype="multipart/form-data"><input name="reset" value="Reset" type="reset"></td></tbody></table>


  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
        <tr>
        <th colspan="4" rowspan="1">{$header}</th>
        </tr>

        <tr>
        <td class="head">Employee</td>
        <td class="even" colspan="3">{$this->employeectrl}</td>
        </tr>

        <tr>
        <td class="head">Date</td>
        <td class="even">
        <input name='overtimeline_date' id='overtimeline_date' value="{$this->overtimeline_date}" maxlength='10' size='10'>
        <input name='btnDate' value="Date" type="button" onclick="{$this->overtimedatectrl}"> <font color=red>YYYY-MM-DD (Ex: 2009-01-30)</font>
        </td>
        <td class="head">Type</td>
        <td class="even">
        <select name="overtimeline_type" onchange="viewHours(this.value)">
        <option value="H" {$selectTypeH}>By Hours</option>
        <option value="T" {$selectTypeT}>By Trip</option>
        </select>
        </td>
        </tr>


        <tr id="idTimeHours" {$styletimehours}>
        <td class="head">Time In</td>
        <td class="even"><input maxlength="4" size="4" name="overtimeline_starttime" value="{$this->overtimeline_starttime}"> (HHMM) 24 Hours Format</td>
        <td class="head">Time Out</td>
        <td class="even"><input maxlength="4" size="4" name="overtimeline_endtime" value="{$this->overtimeline_endtime}"> (HHMM) 24 Hours Format</td>
        </tr>


        <tr>
        <td class="head">Total Hours/Trip</td>
        <td class="even"><input maxlength="10" size="4" name="overtimeline_totalhour" value="{$this->overtimeline_totalhour}"></td>
        <td class="head">Description</td>
        <td class="even"><textarea name="line_desc" cols="40" rows="4">{$this->line_desc}</textarea></td>
        </tr>
 
    </tbody>
  </table>
EOF;
        echo <<<EOF

<br>
<table astyle="width:150px;"><tbody><td width=1 {$stylesave}>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form>
    <td align="right" {$stylesave}>{$deletectrl}</td>
    </tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#15
0
 public function reUse()
 {
     global $selectspliter, $xoopsUser;
     include_once "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $uname = $xoopsUser->getVar('uname');
     $batchno = getNewCode($this->xoopsDB, "batchno", "sim_simbiz_batch");
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $timestamp = date("y/m/d H:i:s", time());
     $arrInsertFieldParent = array("period_id", "batchno", "batch_name", "batchdate", "description", "totaldebit", "totalcredit", "created", "createdby", "updated", "updatedby", "organization_id", "tax_type", "isreadonly", "reuse");
     $arrInsertFieldTypeParent = array("%d", "%s", "%s", "%s", "%s", "%f", "%f", "%s", "%d", "%s", "%d", "%d", "%d", "%d", "%d");
     $arrInsertFieldChild = array("batch_id", "document_no", "amt", "originalamt", "tax_id", "currency_id", "document_no2", "accounts_id", "multiplyconversion", "seqno", "reference_id", "bpartner_id", "isreconciled", "bankreconcilation_id", "transtype", "linedesc", "reconciledate", "branch_id", "track_id1", "track_id2", "track_id3", "created", "createdby", "row_typeline", "temp_parent_id");
     $arrInsertFieldTypeChild = array('%d', '%s', '%f', '%f', '%d', '%d', '%s', '%d', '%f', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d');
     $sqlheader = "select * from sim_simbiz_batch where batch_id = {$this->batch_id} ";
     $this->log->showLog(3, "Reuse header with SQL:{$sqlheader}");
     $query = $this->xoopsDB->query($sqlheader);
     if ($row = $this->xoopsDB->fetchArray($query)) {
         $organization_id = $row['organization_id'];
         $period_id = $row['period_id'];
         $iscomplete = 0;
         $batch_name = $row['batch_name'];
         $description = $row['description'];
         $created = $timestamp;
         $createdby = $this->updatedby;
         $updated = $timestamp;
         $updatedby = $this->updatedby;
         $reuse = $row['reuse'];
         $totaldebit = $row['totaldebit'];
         $totalcredit = $row['totalcredit'];
         $fromsys = $row['fromsys'];
         $batchdate = $row['batchdate'];
         $tax_type = $row['tax_type'];
         $isreadonly = $row['isreadonly'];
         $arrvalue = array($period_id, $batchno, $batch_name, $batchdate, $description, $totaldebit, $totalcredit, $updated, $updatedby . $selectspliter . $uname, $this->updated, $this->updatedby . $selectspliter . $uname, $organization_id, $tax_type, 0, $reuse);
         $rs = $save->InsertRecord($this->tablename, $arrInsertFieldParent, $arrvalue, $arrInsertFieldTypeParent, $batchno, "batch_id");
         if (!$rs) {
             $this->log->showLog(1, "Failed to insert reuse code {$batch_name}:");
             return false;
         }
     }
     $nextbatchid = $this->getBatchID();
     $sqltransaction = "select * from sim_simbiz_transaction where batch_id = {$this->batch_id} ";
     $this->log->showLog(3, "Reuse transaction with SQL:{$sqltransaction}");
     $query = $this->xoopsDB->query($sqltransaction);
     $i = 0;
     while ($row = $this->xoopsDB->fetchArray($query)) {
         $i++;
         $document_no = $row['document_no'];
         $amt = $row['amt'];
         $originalamt = $row['originalamt'];
         $tax_id = $row['tax_id'];
         $currency_id = $row['currency_id'];
         $document_no2 = $row['document_no2'];
         $transtype = $row['transtype'];
         $accounts_id = $row['accounts_id'];
         $multiplyconversion = $row['multiplyconversion'];
         $seqno = $row['seqno'];
         $reference_id = $row['reference_id'];
         $bpartner_id = $row['bpartner_id'];
         $bankreconcilation_id = 0;
         $linedesc = $row['linedesc'];
         $branch_id = $row['branch_id'];
         $track_id1 = $row['track_id1'];
         $track_id2 = $row['track_id2'];
         $track_id3 = $row['track_id3'];
         $row_typeline = $row['row_typeline'];
         $temp_parent_id = $row['temp_parent_id'];
         if ($reference_id > 0) {
             $reference_id = $refid;
         }
         $arrvalue = array($nextbatchid, $document_no, $amt, $amt, $tax_id, $currency_id, $document_no2, $accounts_id, $multiplyconversion, $seqno, $reference_id, $bpartner_id, 0, 0, $transtype, $linedesc, "0000-00-00", $branch_id, $track_id1, $track_id2, $track_id3, $timestamp, $createdby, $row_typeline, $temp_parent_id);
         $rschild = $save->InsertRecord("sim_simbiz_transaction", $arrInsertFieldChild, $arrvalue, $arrInsertFieldTypeChild, $seqno, "trans_id");
         if (!$rschild) {
             $this->log->showLog(1, "Failed to insert reuse code {$batch_name}:");
             return false;
         }
         if ($reference_id == 0) {
             $refid = $this->getLatestTransID();
         }
     }
     return true;
 }
示例#16
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type
     * @param int receipt_id
     * @return
     * @access public
     */
    public function getInputForm($type, $receipt_id, $token)
    {
        global $prefix_rcpt, $mandatorysign;
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $originalamtctrl = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Receipt";
            $action = "create";
            if ($receipt_id == 0) {
                $this->paidfrom = "";
                $this->iscomplete = "";
                $this->exchangerate = 1;
                $this->amt = 0;
                $this->displaychequenostyle = "style='display:none'";
                //$this->receipt_date=date('Y-m-d',time());
                $this->receipt_date = getDateSession();
                $this->batch_id = 0;
                $this->receipt_no = getNewCode($this->xoopsDB, "receipt_no", $this->tablereceipt);
                $this->originalamt = 0;
                $this->iscomplete = 0;
                $this->receipt_prefix = $prefix_rcpt;
            }
            $savectrl = "<input style='height: 40px;' name='btnSave' value='Save' type='button'  onclick='iscomplete.value=0;saveRecord();'>";
            $completectrl = "";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
            $closectrl = "";
            $originalamtctrl = "<input name='originalamt' type='hidden' value='0'>";
        } else {
            $action = "update";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablereceipt}' type='hidden'>" . "<input name='id' value='{$this->receipt_id}' type='hidden'>" . "<input name='idname' value='receipt_id' type='hidden'>" . "<input name='title' value='Financial Year' type='hidden'>" . "<input name='btnView' value='View Record Info' type='submit'>" . "</form>";
            }
            $previewctrl = "<form target='_blank' action='viewreceipt.php' method='POST'>" . "<input name='receipt_id' value='{$this->receipt_id}' type='hidden'>" . "<input name='btnPreview' value='Print Preview' type='submit'>" . "</form>";
            $header = "Edit Receipt";
            if ($this->iscomplete == 0) {
                $deletectrl = "<FORM action='receipt.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this receipt?"' . ")'><input type='submit' value='Delete' name='btnDelete'>" . "<input type='hidden' value='{$this->receipt_id}' name='receipt_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
                $savectrl = "<input name='receipt_id' value='{$this->receipt_id}' type='hidden'>" . "<input style='height: 40px;' name='btnSave' value='Save' type='button' onclick='iscomplete.value=0;saveRecord();'>";
                $completectrl = "<input style='height: 40px;' name='btnComplete' value='Complete' type='button' onclick='iscomplete.value=1;saveRecord();'>";
            } else {
                $deletectrl = "";
                $savectrl = "";
                $completectrl = "";
                if ($this->isAdmin) {
                    $activatectrl = "<FORM action='receipt.php' method='POST' onSubmit='return confirm(" . '"confirm to reactivate this receipt?"' . ")'><input type='submit' value='Reactivate' name='btnActivate'>" . "<input type='hidden' value='{$this->receipt_id}' name='receipt_id'>" . "<input type='hidden' value='reactivate' name='action'><input name='token' value='{$token}' type='hidden'></form>";
                }
            }
            if ($this->batch_id > 0) {
                $viewbatch = "<a href='batch.php?batch_id={$this->batch_id}&action=edit'>View Journal</a>";
            } else {
                $viewbatch = "";
            }
        }
        echo <<<EOF
<A href='receipt.php'>[Add New]</A>&nbsp;<A href='receipt.php?action=showSearchForm'>[Search]</A>
<form onsubmit="return validateReceipt()" method="post"
 action="receipt.php" name="frmReceipt">
<table style="width:140px;"><tbody><td><input name="reset" value="Reset" type="reset"></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="1" cellpadding="0" cellspacing="1">
{$originalamtctrl}
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
<tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan='3'>{$this->orgctrl} {$viewbatch} </td>
      </tr>
      <tr>
   \t<td class="head">Receipt No {$mandatorysign}</td>
        <td class="even" >
        <input name="receipt_prefix" value="{$this->receipt_prefix}" size='3' maxlength='10'>
        <input name="receipt_no" value="{$this->receipt_no}" size='10' maxlength='10'>
\t\t\t<input name="iscomplete" value="{$this->iscomplete}" type='hidden'></td>
        <td class="head">Date {$mandatorysign}</td>
        <td class="even" ><input name='receipt_date' value="{$this->receipt_date}" id='receipt_date'  size='10' maxlength='10'>
\t\t\t\t<input name='btnDate' type='button' value='Date' onclick="{$this->showCalendar}"></td>

      </tr>
      <tr>
        <td class="head">From Accounts</td>
        <td class="even">{$this->accountsfromctrl} <select name="bpartner_id" id="bpartner_id" onchange=changePaidFrom(this)> {$this->bpartnerctrl}</select></div>
\t\t\t<input name='bpartner_id_bc' id='bpartner_id_bc' type='hidden' value="{$this->bpartner_id}"></td>
        <td class="head">Paid From {$mandatorysign}</td>
        <td class="even"><input name='paidfrom' value="{$this->paidfrom}" id='paidfrom'></td>
      </tr>
      <tr>
        <td class="head">Currency {$mandatorysign}</td>
        <td class="even"><select name="currency_id">{$this->currencyctrl}</select></td>
        <td class="head">Exchange Rate {$mandatorysign}</td>
        <td class="even"><input name='exchangerate' value="{$this->exchangerate}" onchange='amt.value=parseFloat(this.value*originalamt.value).toFixed(2)' size="10">
\tLocal Amount :
\t<input name='amt' value="{$this->amt}" readonly='readonly'></td>
      </tr>

      <tr>
        <!--<td class="head">To Accounts /Cheque No {$mandatorysign}</td>
        <td class="even">{$this->accountstoctral} <input value="{$this->chequeno}" name='chequenoa' {$this->displaychequenostyle}></td>-->
        <td class="head">Received By </td>
        <td class="even" colspan="3"><input name='receivedby' value="{$this->receivedby}">
\t\t<input name='batch_id' value="{$this->batch_id}" type='hidden'></td>
      </tr>

    <tr>
        <td class="head">Add Line</td>
\t<td class="even" colspan="3">
\t\t<SELECT name='addreceiptlineqty' >
\t\t\t<OPTION value='0'>0 Line</OPTION>
\t\t\t<OPTION value='1'>1 Line</OPTION>
\t\t\t<OPTION value='2'>2 Line</OPTION>
\t\t\t<OPTION value='3'>3 Line</OPTION>
\t\t\t<OPTION value='5'>5 Line</OPTION>
\t\t\t<OPTION value='10'>10 Line</OPTION>
\t\t\t<OPTION value='15'>15 Line</OPTION>
\t\t</SELECT>
\t</td>
      </tr>
\t{$this->receiptlinectrl}

      <tr>
        <td class="head">Description</td>
        <td class="even" colspan='3'><textarea cols='70' name='description' >{$this->description}</textarea></td>
      </tr>
  <tr>
        <td class="head">Add New Record</td>
        <td class="even" colspan='3'><input type='checkbox' name='chkAddNew'> Add new record immediately after save or complete.</td>
      </tr>
\t     <!-- <tr>
        <td class="head">Amount {$mandatorysign} </td>
        <td class="even" colspan="3">
\t<input name='originalamta' value="{$this->originalamta}" onchange='amt.value=parseFloat(exchangerate.value*this.value).toFixed(2)' >
\t</td>
      </tr>-->
    </tbody>
  </table>
<table style="width:150px;"><tbody><td>{$savectrl} </td><td>{$completectrl}</td>
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td></tbody>
\t</table></form>
\t<table style="width:150px;">
\t<td>{$deletectrl} {$activatectrl}</td><td>{$recordctrl}</td><td>{$previewctrl}</td></table>
  <br>



EOF;
    }
示例#17
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int bpartner_id 
     * @return 
     * @access public
     */
    public function getInputForm($type, $bpartner_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Business Partner";
            $action = "create";
            if ($bpartner_id == 0) {
                $this->bpartner_name = "";
                $this->isactive = 1;
                $this->defaultlevel = 10;
                $this->employeecount = 0;
                $this->currentpurchasecreditstatus = 0;
                $this->currentbalance = 0;
                $this->currentsalescreditstatus = 0;
                $this->salescreditlimit = 0;
                $this->purchasecreditlimit = 0;
            }
            $savectrl = "<input style='height: 40px;' name='submit' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
            $this->bpartner_no = getNewCode($this->xoopsDB, "bpartner_no", $this->tablebpartner);
        } else {
            $action = "update";
            $savectrl = "<input name='bpartner_id' value='{$this->bpartner_id}' type='hidden'>\r\n\t\t\t<input style='height: 40px;' name='submit' value='Save' \r\n            type='submit' onclick='action.value=\"update\"'></td><td>\r\n            <input style='height: 40px;' name='submit' value='Cancel'\r\n            type='submit' onclick='action.value=\"view\"'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablebpartner}' type='hidden'>" . "<input name='id' value='{$this->bpartner_id}' type='hidden'>" . "<input name='idname' value='bpartner_id' type='hidden'>" . "<input name='title' value='BPartner' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            if ($this->isdebtor == 1) {
                $isdebtorchecked = "CHECKED";
            } else {
                $isdebtorchecked = "";
            }
            if ($this->iscreditor == 1) {
                $iscreditorchecked = "CHECKED";
            } else {
                $iscreditorchecked = "";
            }
            if ($this->istransporter == 1) {
                $istransporterchecked = "CHECKED";
            } else {
                $istransporterchecked = "";
            }
            if ($this->isdealer == 1) {
                $isdealerchecked = "CHECKED";
            } else {
                $isdealerchecked = "";
            }
            if ($this->isprospect == 1) {
                $isprospectchecked = "CHECKED";
            } else {
                $isprospectchecked = "";
            }
            if ($this->enforcesalescreditlimit == 1) {
                $enforcesalescreditlimitchecked = "CHECKED";
            } else {
                $enforcesalescreditlimitchecked = "";
            }
            if ($this->enforcepurchasecreditlimit == 1) {
                $enforcepurchasecreditlimitchecked = "CHECKED";
            } else {
                $enforcepurchasecreditlimitchecked = "";
            }
            $header = "Edit Business Partner";
            if ($this->allowDelete($this->bpartner_id)) {
                $deletectrl = "<FORM action='bpartner.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this bpartner?"' . ")'><input type='submit' value='Delete' name='submit'>" . "<input type='hidden' value='{$this->bpartner_id}' name='bpartner_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='bpartner.php' method='POST'><input name='submit' value='New' type='submit'></form>";
        }
        echo <<<EOF
<script type='text/javascript'>
    function showAccountParameter(){
        var trAccountParameter=document.getElementById("trAccountParameter");
        var btnShowAccountParameter=document.getElementById("btnShowAccountParameter");
        if(trAccountParameter.style.display=="none"){
            trAccountParameter.style.display="";
            btnShowAccountParameter.value="Hide Account Info";
        }
        else{
            trAccountParameter.style.display="none";
            btnShowAccountParameter.value="Display Account Info";
        }
    }
</script>
<form onsubmit="return validateBPartner()" method="post"
 action="bpartner.php" name="frmBPartner"><table style="width:140px;"><tbody><td><input name="reset" value="Reset" type="reset"></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="1" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" >{$this->orgctrl}</td>
   \t<td class="head">Business Partner Group {$mandatorysign}</td>
        <td class="even" >{$this->bpartnergroupctrl}</td>
      </tr>
      <tr>
       <td class="head">Business Partner No {$mandatorysign}</td>
        <td class="even" ><input maxlength="10" size="10" name="bpartner_no" value="{$this->bpartner_no}">
\t&nbsp;Active <input type="checkbox" {$checked} name="isactive"> Default Level {$mandatorysign} <input maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>
        <td class="head">Business Partner Name {$mandatorysign}</td>
        <td class="even" ><input maxlength="50" size="35" name="bpartner_name" value="{$this->bpartner_name}">
\t\t</td>
      </tr>

      <tr>
    \t<td class="head">Company No</td>
\t    <td class="even" ><input name='companyno' value="{$this->companyno}"></td>
        <td class="head">Alternate Name</td>
\t    <td class="even" ><input name='alternatename' value='{$this->alternatename}'></td>
      </tr>
      <tr>
    \t<td class="head">Industry</td>
\t    <td class="even" >{$this->industryctrl}</td>
        <td class="head">Employee Count</td>
\t    <td class="even" ><input name='employeecount' value='{$this->employeecount}'></td>
      </tr>
     <tr>
    \t<td class="head">Is Debtor (Customer)</td>
\t    <td class="even" ><input type='checkbox' name='isdebtor' {$isdebtorchecked}></td>
        <td class="head">Is Creditor (Supplier)</td>
\t    <td class="even" ><input type='checkbox' name='iscreditor' {$iscreditorchecked}></td>
      </tr>
     <tr>
    \t<td class="head">Is Transporter</td>
\t    <td class="even" ><input type='checkbox' name='istransporter' {$istransporterchecked}></td>
        <td class="head">Is Dealer</td>
\t    <td class="even" ><input type='checkbox' name='isdealer' {$isdealerchecked}></td>
      </tr>
     <tr>
    \t<td class="head">Is Prospect</td>
\t    <td class="even" ><input type='checkbox' name='isprospect' {$isprospectchecked}></td>
        <td class="head">Terms</td>
\t    <td class="even" >{$this->termsctrl}</td>
      </tr>

       <tr>
        <td class="head">Tooltips</td>
\t    <td class="even"><input name='tooltips' value='{$this->tooltips}' size='45'></td>
        <td class="head">Website</td>
\t    <td class="even"><input name='bpartner_url' value='{$this->bpartner_url}' size='45'></td>
      </tr>
      <tr>
        <td class="head">Description</td>
\t    <td class="even" colspan='3'>
                <textarea cols='65' rows='6' name='description'>{$this->description}</textarea>
                
                
        </td>
      </tr>
      <tr>
        <td class="head">Currency</td>
        <td class="even" >{$this->currencyctrl}</td>
    \t<td class="head"></td>
    \t<td class="even" >
                <input type='button' value='Display Account Info'
                        id='btnShowAccountParameter' onclick='showAccountParameter()'>
        </td>
      </tr>
      <tr id='trAccountParameter' style='display:none'><td colspan='4' class='even'>
        Accounting Parameter:<br>
        <table><tbody>
           <tr>
            <td class="foot">Debtor Account</td>
\t        <td class="odd" id="iddebtoraccountsctrl">{$this->debtoraccountsctrl}<input type='hidden' name='previousaccounts_id' value="{$this->debtoraccounts_id}"></td>
            <td class="foot">Creditor Account</td>
\t        <td class="odd" id="idcreditoraccountsctrl">{$this->creditoraccountsctrl}<input type='hidden' name='previousaccounts_id' value="{$this->creditoraccounts_id}"></td>
           </tr>
           <tr>
            <td class="foot">Sales Credit Limit</td>
\t        <td class="odd"><input name='salescreditlimit' value="{$this->salescreditlimit}"></td>
            <td class="foot">Purchase Credit Limit</td>
\t        <td class="odd"><input name='purchasecreditlimit' value="{$this->purchasecreditlimit}"></td>
           </tr>
           <tr>
            <td class="foot">Control Sales Credit Limit</td>
\t        <td class="odd"><input type='checkbox' name='enforcesalescreditlimit' {$enforcesalescreditlimitchecked}></td>
            <td class="foot">Control Purchase Credit Limit</td>
\t        <td class="odd"><input type='checkbox' name='enforcepurchasecreditlimit' {$enforcepurchasecreditlimitchecked}></td>
           </tr>
           <tr>
            <td class="foot">Current Sales Limit Status</td>
\t        <td class="odd"><input name='currentsalescreditstatus' value="{$this->currentsalescreditstatus}"></td>
            <td class="foot">Current Purchase Limit Status</td>
\t        <td class="odd"><input name='currentpurchasecreditstatus' value="{$this->currentpurchasecreditstatus}"></td>
           </tr>
           <tr>
            <td class="foot">Tax</td>
\t        <td class="odd">{$this->taxctrl}</td>
            <td class="foot">Bank Name</td>
\t        <td class="odd"><input name='bankname' value="{$this->bankname}"></td>
           </tr>
           <tr>
            <td class="foot">Bank Account Name</td>
\t        <td class="odd"><input name='bankaccountname' value="{$this->bankaccountname}"></td>
            <td class="foot">Bank Account No</td>
\t        <td class="odd"><input name='bankaccountno' value="{$this->bankaccountno}"></td>
           </tr>
       </tbody></table></td>
      </tr>
 
    </tbody>
  </table>
<table style="width:150px;"><tbody><td >{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></form></td>
    <td>{$deletectrl}</td><td>{$recordctrl}</td>
\t</tbody></table>
\t
  <br>

EOF;
    }
示例#18
0
 public function getTypeNo($paymentvoucher_type)
 {
     $retval = getNewCode($this->xoopsDB, "paymentvoucher_no", $this->tablepaymentvoucher, " and paymentvoucher_type = '{$paymentvoucher_type}' ");
     return $retval;
 }
示例#19
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type 
     * @param int employee_id
     * @return 
     * @access public
     */
    public function getInputForm($type, $employee_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $searchctrl = "";
        $deletectrl = "";
        $itemselect = "";
        $styleviewdetails = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Employee";
            $action = "create";
            $styleviewdetails = "display:none";
            if ($employee_id == 0) {
                //$checkedF = "CHECKED";
                $this->employee_name = "";
                $this->gender = "M";
                $this->marital_status = "S";
                $this->isactive = "";
                $this->islecturer = "";
                $this->isovertime = "";
                $this->isfulltime = "";
                $this->issalesrepresentative = "";
                $this->employee_salarymethod = "B";
                $this->defaultlevel = 10;
                $this->annual_leave = 0;
                $this->employee_salary = 0;
                $this->employee_ottrip = 0;
                $this->employee_othour = 0;
                $employeechecked = "CHECKED";
                $this->employee_no = getNewCode($this->xoopsDB, "employee_no", $this->tableemployee, "");
                $this->employee_rate = 1;
            }
            $savectrl = "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            if ($type == "edit") {
                $action = "update";
                $savectrl = "<input name='employee_id' value='{$this->employee_id}' type='hidden'>" . "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
                if ($this->isAdmin) {
                    $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tableemployee}' type='hidden'>" . "<input name='id' value='{$this->employee_id}' type='hidden'>" . "<input name='idname' value='employee_id' type='hidden'>" . "<input name='title' value='Employee' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
                }
                $header = "Edit Basic Employee Profile";
                if ($this->allowDelete($this->employee_id)) {
                    $deletectrl = "<FORM action='employee.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this employee?"' . ")'><input type='submit' value='Delete' name='submit'>" . "<input type='hidden' value='{$this->employee_id}' name='employee_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
                } else {
                    $deletectrl = "";
                }
                $addnewctrl = "<Form action='employee.php' method='POST'><input name='submit' value='New' type='submit'></form>";
            } else {
                $action = "view";
                $header = "View Basic Employee Profile";
                if ($this->isAdmin) {
                    $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tableemployee}' type='hidden'>" . "<input name='id' value='{$this->employee_id}' type='hidden'>" . "<input name='idname' value='employee_id' type='hidden'>" . "<input name='title' value='Employee' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
                }
                $addnewctrl = "<Form action='employee.php' method='POST'><input name='submit' value='New' type='submit'></form>";
            }
        }
        // start set display input
        $formdisabled = "";
        $formdisplay = "";
        $formreadonly = "";
        $formchecked = "";
        $formsubmit = "onsubmit='return validateEmployee()' ";
        $editctrl = "";
        if ($action == "create") {
        } else {
            if ($action == "update") {
                $editctrl = "<Form action='employee.php' method='POST'>\r\n        <input name='submit' value='Back To View Mode' type='submit'>\r\n        <input name='employee_id' type='hidden' value='{$this->employee_id}'>\r\n        <input name='action' value='view' type='hidden'>\r\n        </form>";
            } else {
                $formdisabled = "disabled";
                $formdisplay = "style = 'display:none' ";
                $formreadonly = "readonly";
                $formsubmit = "onsubmit = 'return false' ";
                $formchecked = ' onclick="javascript:if(this.checked==true){this.checked=false;}else{this.checked=true}" ';
                $editctrl = "<Form action='employee.php' method='POST'>\r\n        <input name='submit' value='Edit Basic Profile' type='submit'>\r\n        <input name='employee_id' type='hidden' value='{$this->employee_id}'>\r\n        <input name='action' value='edit' type='hidden'>\r\n        </form>";
            }
        }
        $this->admindisplay = "style='display:none'";
        if ($this->isAdmin) {
            $this->admindisplay = "";
        }
        //end of set display input
        $searchctrl = "<Form action='employee.php' method='POST'>\r\n                            <input name='submit' value='Search' type='submit'>\r\n                            <input name='action' value='search' type='hidden'>\r\n                            </form>";
        $selectICB = "";
        $selectICR = "";
        if ($this->ic_color == "B") {
            $selectICB = "SELECTED";
        } else {
            $selectICR = "SELECTED";
        }
        $selectGenderM = "";
        $selectGenderF = "";
        if ($this->gender == "M") {
            $selectGenderM = "SELECTED";
        } else {
            $selectGenderF = "SELECTED";
        }
        $selectMaritalS = "";
        $selectMaritalM = "";
        if ($this->marital_status == "S") {
            $selectMaritalS = "SELECTED";
        } else {
            $selectMaritalM = "SELECTED";
        }
        //force isactive checkbox been checked if the value in db is 'Y'
        if ($this->isactive == 1) {
            $checked = "CHECKED";
        } else {
            $checked = "";
        }
        if ($this->islecturer == 1) {
            $checkedL = "CHECKED";
        } else {
            $checkedL = "";
        }
        if ($this->isovertime == 1) {
            $checkedO = "CHECKED";
            $stylerateot = "";
        } else {
            $checkedO = "";
            $stylerateot = "display:none";
        }
        if ($this->isfulltime == 1) {
            $checkedF = "CHECKED";
        } else {
            $checkedF = "";
        }
        if ($this->issalesrepresentative == 1) {
            $checkedS = "CHECKED";
        } else {
            $checkedS = "";
        }
        if ($this->employee_salarymethod == "Q") {
            $selectCheque = "selected";
        } else {
            if ($this->employee_salarymethod == "C") {
                $selectCash = "selected";
            } else {
                if ($this->employee_salarymethod == "B") {
                    $selectBank = "selected";
                }
            }
        }
        $photourl = "";
        $icurl = "";
        $spmurl = "";
        if ($this->filephoto != "") {
            $photourl = "upload/employee/photo/{$this->filephoto}";
        }
        $photoalert = "";
        if (!file_exists($photourl) || $photourl == "") {
            $photourl = "";
            $photoalert = "<font color='red'><b><u>Photo Not Available.</u></b></font>";
        }
        $select_epf1 = "";
        $select_epf2 = "";
        $select_epf3 = "";
        if ($this->employee_epfrate == 1) {
            $select_epf1 = "SELECTED='SELECTED'";
        } elseif ($this->employee_epfrate == 2) {
            $select_epf2 = "SELECTED='SELECTED'";
        } else {
            $select_epf3 = "SELECTED='SELECTED'";
        }
        $stylefinance = "style='display:none'";
        echo <<<EOF


<table style="width:140px;">
<tbody>
<td {$stylefinance}>{$addnewctrl}</td>
<td>{$searchctrl}</td>
<td><form {$formsubmit} method="post"
 action="employee.php" name="frmEmployee" enctype="multipart/form-data"><input name="reset" value="Reset" type="reset"></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr {$stylefinance}>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" acolspan="3">{$this->orgctrl}&nbsp;Active <input {$formchecked} type="checkbox" {$checked} name="isactive"></td>
\t\t\t<td class="head" astyle="display:none">Default Level {$mandatorysign}</td>
\t        <td class="even"  astyle="display:none"><input {$formreadonly} maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>
   \t
      </tr>

      <tr>
\t  \t<td class="head" astyle="display:none">Employee No {$mandatorysign}
        <br><br>Name {$mandatorysign}
        <br><br>Other Name

        </td>
        <td class="even" astyle="display:none">
        <input {$formreadonly} maxlength="10" size="10" name="employee_no" value="{$this->employee_no}" readonly><br><br>
        <input {$formreadonly} maxlength="100" size="50" name="employee_name" value="{$this->employee_name}" readonly><br><br>
        <input {$formreadonly} maxlength="100" size="50" name="employee_altname" value="{$this->employee_altname}" readonly><br><br>
        <div {$formdisplay}  {$stylefinance}>{$this->uidctrl}</div>
        </td>
        <td class="head" colspan="2" arowspan="2" >

        <table>
        <tr height="100">
        <td style="background-color:gainsboro" align="center">
        <a href="{$photourl}" target="blank"><img src="{$photourl}" width="200" height="200"></a>{$photoalert}</td>
        </tr>
        <tr {$stylefinance}>
        <td><input {$formdisplay} type="file" name="filephoto">&nbsp;&nbsp;Remove Photo <input {$formdisplay} type="checkbox" name="deleteAttachmentPhoto" title="Choose it if you want to remove this Photo">
        <br>(200 x 200 : JPG Format only)
        </td>
        </tr>
        </table>
        
        </td>
      </tr>

      <tr {$stylefinance}>
        <td class="head">Job Position</td>
        <td class="even" colspan="3">
        {$this->jobpositionctrl}
        <br>
        <a onclick="showJobDescription()" style="cursor:pointer">Show Job Description >></a>
        <div>
        <textarea {$formreadonly} style="display:none" name="employee_jobdescription" cols="80" rows="15">{$this->employee_jobdescription}</textarea>
        </div>
        </td>
      </tr>

      <tr {$stylefinance}>
        <td class="head">Group</td>
        <td class="even">{$this->employeegroupctrl}</td>
        <td class="head">Department</td>
        <td class="even">{$this->departmentctrl}</td>
      </tr>

        <tr>
        <td class="head">Employee OT Rate</td>
        <td class="even" colspan="3">
        <table style="width:1%;{$stylerateot}" id="idOTRate">
        <tr>
        <td nowrap><b>Rate Hours (OT)</b></td>
        <td nowrap>: <input {$formreadonly} maxlength="12" size="10" name="employee_ottrip" value="{$this->employee_ottrip}"></td>
        <td nowrap><b>Rate Trip (OT)</b></td>
        <td nowrap>: <input {$formreadonly} maxlength="12" size="10" name="employee_othour" value="{$this->employee_othour}"></td>
        </tr>
        </table>
        </td>
        </tr>

      <tr {$stylefinance}>
\t  \t<td class="head">New IC No<br><br>Date Of Birth<br><br>Place Of Birth</td>
        <td class="even">
        <input {$formreadonly} maxlength="20" size="15" name="employee_newicno" value="{$this->employee_newicno}"> <font color=red>(Ex: 800130-01-5577)</font><br><br>
        <input {$formreadonly} name='employee_dob' id='employee_dob' value="{$this->employee_dob}" maxlength='10' size='10'>
    \t<input {$formdisplay} name='btnDate' value="Date" type="button" onclick="{$this->dobdatectrl}"> <font color=red>YYYY-MM-DD (Ex: 1980-01-30)</font><br><br>
        <input {$formreadonly} maxlength="100" size="50" name="place_dob" value="{$this->place_dob}">
        </td>
        <td class="head">Old IC No</td>
        <td class="even" ><input {$formreadonly} maxlength="20" size="15" name="employee_oldicno" value="{$this->employee_oldicno}"></td>
      </tr>

      <tr {$stylefinance}>
        <td class="head">IC Color</td>
        <td class="even" >
        <select name="ic_color" {$formdisabled}>
        <option value="B" {$selectICB}>Blue</option>
        <option value="R" {$selectICR}>Red</option>
        </select>
        </td>
\t  \t<td class="head">IC Issue Place</td>
        <td class="even"><input {$formreadonly} maxlength="50" size="30" name="ic_placeissue" value="{$this->ic_placeissue}"></td>
      </tr>

     <tr {$stylefinance}>
        <td class="head">Races / Religion / Gender</td>
        <td class="even">
            {$this->racesctrl}
            {$this->religionctrl}
            <select name="gender" {$formdisabled}>
            <option value="M" {$selectGenderM}>Male</option>
            <option value="F" {$selectGenderF}>Female</option>
            </select>
        </td>
\t  \t<td class="head">Marital Status</td>
        <td class="even">
            <select name="marital_status" {$formdisabled}>
            <option value="S" {$selectMaritalS}>Single</option>
            <option value="M" {$selectMaritalM}>Married</option>
            </select>
        </td>
      </tr>

      <tr  {$stylefinance}>
\t  \t<td class="head">Permanent Address</td>
        <td class="even" colspan="3" valign="top">
        <textarea {$formreadonly} name="permanent_address" cols="40" rows="4">{$this->permanent_address}</textarea><br><br>
        Postcode <input {$formreadonly} maxlength="10" size="8" name="permanent_postcode" value="{$this->permanent_postcode}">
        City <input {$formreadonly} maxlength="30" size="20" name="permanent_city" value="{$this->permanent_city}">
        State <input {$formreadonly} maxlength="20" size="20" name="permanent_state" value="{$this->permanent_state}">
        Country {$this->permanentcountryctrl} <br><br>
        Tel No &nbsp;&nbsp;&nbsp;&nbsp;<input {$formreadonly} maxlength="15" size="12" name="permanent_telno" value="{$this->permanent_telno}">
        </td>
      </tr>

      <tr  {$stylefinance}>
\t  \t<td class="head">Contact Address</td>
        <td class="even" colspan="3" valign="top">
        <textarea {$formreadonly} name="contact_address" cols="40" rows="4">{$this->contact_address}</textarea><br><br>
        Postcode <input {$formreadonly} maxlength="10" size="8" name="contact_postcode" value="{$this->contact_postcode}">
        City <input {$formreadonly} maxlength="30" size="20" name="contact_city" value="{$this->contact_city}">
        State <input {$formreadonly} maxlength="20" size="20" name="contact_state" value="{$this->contact_state}">
        Country {$this->contactcountryctrl}<br><br>
        Tel No &nbsp;&nbsp;&nbsp;&nbsp;<input {$formreadonly} maxlength="15" size="12" name="contact_telno" value="{$this->contact_telno}">
        </td>
      </tr>

        <tr {$stylefinance}>
        <td class="head">Supervisor 1</td>
        <td class="even" colspan="3">{$this->supervisor1ctrl}</td>
        <td class="head" style="display:none">Supervisor 2</td>
        <td class="even" style="display:none">{$this->supervisor2ctrl}</td>
        </tr>

      <tr {$stylefinance}>
        <td class="head">HP No {$mandatorysign}</td>
        <td class="even"><input {$formreadonly} maxlength="15" size="12" name="employee_hpno" value="{$this->employee_hpno}"></td>
        <td class="head">Annual Leave</td>
        <td class="even" ><input {$formreadonly} maxlength="11" size="3" name="annual_leave" value="{$this->annual_leave}"></td>
      </tr>


      <tr {$stylefinance}>
        <td class="head">EPF No</td>
        <td class="even"><input {$formreadonly} maxlength="20" size="10" name="employee_epfno" value="{$this->employee_epfno}"></td>
        <td class="head">Socso No</td>
        <td class="even"><input {$formreadonly} maxlength="20" size="10" name="employee_socsono" value="{$this->employee_socsono}"></td>
      </tr>

      <tr {$stylefinance}>
        <td class="head">Tax No</td>
        <td class="even"><input {$formreadonly} maxlength="20" size="10" name="employee_taxno" value="{$this->employee_taxno}"></td>
        <td class="head">No Pencen</td>
        <td class="even"><input {$formreadonly} maxlength="20" size="10" name="employee_pencenno" value="{$this->employee_pencenno}"></td>
      </tr>

      <tr {$stylefinance}>
        <td class="head">Join Date</td>
        <td class="even">
        <input {$formreadonly} name='employee_joindate' id='employee_joindate' value="{$this->employee_joindate}" maxlength='10' size='10'>
    \t<input {$formdisplay} name='btnDate' value="Date" type="button" onclick="{$this->joindatectrl}">
        </td>
        <td class="head">Conformation Date</td>
        <td class="even">
        <input {$formreadonly} name='employee_confirmdate' id='employee_confirmdate' value="{$this->employee_confirmdate}" maxlength='10' size='10'>
    \t<input {$formdisplay} name='btnDate' value="Date" type="button" onclick="{$this->confirmdatectrl}">
        </td>
      </tr>


      <tr {$stylefinance}>
        <td class="head">Remarks</td>
        <td class="even" ><textarea {$formreadonly} name="description" cols="40" rows="3">{$this->description}</textarea></td>
        <td class="head">Access Card No</td>
        <td class="even" ><input {$formreadonly} name="employee_cardno" value="{$this->employee_cardno}" ></td>
      </tr>
 

        <tr>
        <th colspan="4">Payroll Information</th>
        </tr>

      <tr>
\t  \t<td class="head">Basic Salary (RM)</td>
        <td class="even">
        <input {$formreadonly} maxlength="12" size="10" name="employee_salary" value="{$this->employee_salary}">
        &nbsp;&nbsp;EPF (%)
\t\t<select name="employee_epfrate">
                <option value=3 {$select_epf3}>0%</option>
\t\t<option value=2 {$select_epf2}>11%</option>
\t\t<option value=1 {$select_epf1}>8%</option>
\t\t</select>
        </td>
        <td class="head">Payment Method</td>
        <td class="even">
            <select name="employee_salarymethod" {$formdisabled}>
            <option value="B" {$selectBank}>Bank</option>
            <option value="C" {$selectCash}>Cash</option>
            <option value="Q" {$selectCheque}>Cheque</option>
            </select>
        </td>
      </tr>

      <tr>
        <td class="head">Bank Account No</td>
        <td class="even"><input {$formreadonly} maxlength="20" size="20" name="employee_accno" value="{$this->employee_accno}"></td>
        <td class="head">Bank Name</td>
        <td class="even"><input {$formreadonly} maxlength="50" size="20" name="employee_bankname" value="{$this->employee_bankname}"></td>
      </tr>

       <tr {$formdisplay}>
        <th class="head" colspan="4"><input type="checkbox" name="createnewrecord"> Redirect To New Record?</th>
        </tr>

    </tbody>
  </table>
<br>

<table style="width:150px;"><tbody><td {$formdisplay}>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form><td {$this->admindisplay}>{$editctrl}</td><td {$formdisplay} {$this->admindisplay}>{$deletectrl}</td></tbody></table>

  <br>

{$recordctrl}
EOF;
        if ($action == "view") {
            //$this->getTablePortfolioLine($token);
            //$this->getTableActivityLine($token);
            $this->getTableAllowanceLine($token);
            //$this->getTableAppraisalLine($token);
            //$this->getTableAttachmentLine($token);
            //$this->getTableDisciplineLine($token);
        }
    }
示例#20
0
$user = new User();
$VEmail = new VerifyEmail();
if (isset($PARAMS['username']) && isset($PARAMS['password']) && isset($PARAMS['email'])) {
    $user->username = $PARAMS['username'];
    $user->Find();
    if (!$user->variables) {
        $VEmail->email = $PARAMS['email'];
        $VEmail->Find();
        if (!$VEmail->variables) {
            $user->username = $PARAMS['username'];
            $user->password = md5(base64_encode($PARAMS['password']));
            $user->create_date = date("Ymd");
            $user->email = $PARAMS['email'];
            $user->Create();
            $VEmail->email = $PARAMS['email'];
            $VEmail->code = getNewCode();
            $VEmail->username = $PARAMS['username'];
            $VEmail->Create();
            sendVerificationEmail($VEmail->email, $user->username, $VEmail->code);
            $datos = array("status" => "OK");
            print_r(json_encode($datos));
        } elseif (!$VEmail->verified) {
            $datos = array("status" => "inUseNotVerified");
            print_r(json_encode($datos));
        } else {
            $datos = array("status" => "emailInUse");
            print_r(json_encode($datos));
        }
    } else {
        $datos = array("status" => "UsernameInUse");
        print_r(json_encode($datos));
示例#21
0
    /**
     * Display input form, type can be 'new', or 'edit', if new all field will be set
     * empty or 0. Or else all field data will pull from database.
     *
     * @param string type
     * @param int reminder_id
     * @return
     * @access public
     */
    public function getInputForm($type, $reminder_id, $token)
    {
        $mandatorysign = "<b style='color:red'>*</b>";
        $header = "";
        // parameter to display form header
        $action = "";
        $savectrl = "";
        $deletectrl = "";
        $itemselect = "";
        $orgctrl = "";
        $this->created = 0;
        if ($type == "new") {
            $header = "New Reminder";
            $action = "create";
            if ($reminder_id == 0) {
                $this->reminder_title = "";
                $this->isactive = "";
                $this->defaultlevel = 10;
                $this->reminder_id = getNewCode($this->xoopsDB, "reminder_id", $this->tablereminder, "");
            }
            $savectrl = "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
            $checked = "CHECKED";
            $deletectrl = "";
            $addnewctrl = "";
            $selectStock = "";
            $selectClass = "";
            $selectCharge = "";
        } else {
            $action = "update";
            $savectrl = "<input name='reminder_id' value='{$this->reminder_id}' type='hidden'>" . "<input astyle='height: 40px;' name='submit' value='Save' type='submit'>";
            if ($this->isAdmin) {
                $recordctrl = "<form target='_blank' action='recordinfo.php' method='POST'>" . "<input name='tablename' value='{$this->tablereminder}' type='hidden'>" . "<input name='id' value='{$this->reminder_id}' type='hidden'>" . "<input name='idname' value='reminder_id' type='hidden'>" . "<input name='title' value='Reminder' type='hidden'>" . "<input name='submit' value='View Record Info' type='submit'>" . "</form>";
            }
            //force isactive checkbox been checked if the value in db is 'Y'
            if ($this->isactive == 1) {
                $checked = "CHECKED";
            } else {
                $checked = "";
            }
            $header = "Edit Reminder";
            if ($this->allowDelete($this->reminder_id)) {
                $deletectrl = "<FORM action='reminder.php' method='POST' onSubmit='return confirm(" . '"confirm to remove this reminder?"' . ")'><input type='submit' value='Delete' name='submit'>" . "<input type='hidden' value='{$this->reminder_id}' name='reminder_id'>" . "<input type='hidden' value='delete' name='action'><input name='token' value='{$token}' type='hidden'></form>";
            } else {
                $deletectrl = "";
            }
            $addnewctrl = "<Form action='reminder.php' method='POST'><input name='submit' value='New' type='submit'></form>";
        }
        echo <<<EOF


<table style="width:140px;"><tbody><td>{$addnewctrl}</td><td><form onsubmit="return validateReminder()" method="post"
 action="reminder.php" name="frmReminder"><input name="reset" value="Reset" type="reset"></td></tbody></table>

  <table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="1">
    <tbody>
      <tr>
        <th colspan="4" rowspan="1">{$header}</th>
      </tr>
      <tr>
        <td class="head">Organization {$mandatorysign}</td>
        <td class="even" colspan="3">{$this->orgctrl}&nbsp;Active <input type="checkbox" {$checked} name="isactive"></td>
\t\t\t<td class="head" style="display:none">Default Level {$mandatorysign}</td>
\t        <td class="even"  style="display:none"><input maxlength="3" size="3" name='defaultlevel' value='{$this->defaultlevel}'>

      </tr>
      <tr>
\t<td class="head">Reminder Title {$mandatorysign}</td>
        <td class="even" ><textarea name="reminder_title" cols="80" rows="2">{$this->reminder_title}</textarea></td>
      </tr>
      <tr>
        <td class="head">Reminder Description</td>
        <td class="even" colspan='3'><textarea name="reminder_body" cols="80" rows="4">{$this->reminder_body}</textarea></td>
      </tr>
      <tr>
        <td class="head">Reminder Footer</td>
        <td class="even" colspan='3'><textarea name="reminder_footer" cols="80" rows="2">{$this->reminder_footer}</textarea></td>
      </tr>

    </tbody>
  </table>
<table style="width:150px;"><tbody><td>{$savectrl}
\t<input name="action" value="{$action}" type="hidden">
\t<input name="token" value="{$token}" type="hidden"></td>
\t</form><td>{$deletectrl}</td></tbody></table>
  <br>

{$recordctrl}

EOF;
    }
示例#22
0
 /**
  * Save new otapproval into database
  *
  * @return bool
  * @access public
  */
 public function insertOtapproval()
 {
     $this->overtime_no = getNewCode($this->xoopsDB, "overtime_no", $this->tableovertime, "");
     $timestamp = date("y/m/d H:i:s", time());
     $this->log->showLog(3, "Inserting new otapproval {$this->otapproval_name}");
     $sql = "INSERT INTO {$this->tableovertime}\r\n    (overtime_date,overtime_no,\r\n    created,createdby,updated,updatedby,\r\n    employee_id,payment_type,\r\n    overtime_chequeno,period_id,\r\n    organization_id,description,verified_by)\r\n    values(\r\n\t'{$this->overtime_date}','{$this->overtime_no}',\r\n    '{$timestamp}',{$this->createdby},'{$timestamp}',{$this->updatedby},\r\n    {$this->employee_id},'{$this->payment_type}',\r\n    '{$this->overtime_chequeno}',{$this->period_id},\r\n    {$this->organization_id},'{$this->description}',{$this->verified_by})";
     $this->changesql = $sql;
     $this->log->showLog(4, "Before insert otapproval SQL:{$sql}");
     $rs = $this->xoopsDB->query($sql);
     if (!$rs) {
         $this->overtime_no = "";
         $this->log->showLog(1, "Failed to insert otapproval code {$otapproval_name}:" . mysql_error() . ":{$sql}");
         return false;
     } else {
         $this->log->showLog(3, "Inserting new otapproval {$otapproval_name} successfully");
         return true;
     }
 }
示例#23
0
 public function generateStudent()
 {
     global $defaultorganization_id;
     include "../marketing/setting.php";
     $timestamp = date("y/m/d H:i:s", time());
     $this->changesql = "";
     $i = 0;
     foreach ($this->student_id as $id) {
         $i++;
         $isselected = $this->isselected[$i];
         if ($isselected == "on") {
             $matrix_no = getNewCode($this->xoopsDB, "student_no", "{$this->tablestudent}", "");
             $temp_password = rand(1000000, 9999999);
             //$yearsession = getYearSession();
             //$year_id = $yearsession['year_id'];
             //$session_id = $yearsession['session_id'];
             $year_id = $marketingyear_id;
             $session_id = $marketingsession_id;
             //echo "$year_id $session_id";
             $sqlapplicant = "select '{$timestamp}' as created,{$this->updatedby} as createdby,'{$timestamp}' as updated,{$this->updatedby} as updatedby,\r\n        ucase(student_name),'{$matrix_no}' as student_no,student_newicno,student_address,gender,student_postcode,student_state,student_city,\r\n        country_id,student_telno,student_hpno,religion_id,races_id,marital_status,filephoto,fileic,filespm,course_id,student_dob,\r\n        '{$temp_password}' as temp_password,{$year_id} as year_id,{$session_id} as session_id,{$defaultorganization_id} as organization_id,{$id} as applicant_id\r\n        from {$this->tablestudentonline}\r\n        where student_id = {$id} \r\n        and (select count(*) from {$this->tablestudent} where applicant_id = {$id}) = 0 ";
             $sqlstudent = "insert into {$this->tablestudent}\r\n        (created,createdby,updated,updatedby,student_name,student_no,student_newicno,student_address,gender,student_postcode,student_state,student_city,\r\n        country_id,student_telno,student_hpno,religion_id,races_id,marital_status,filephoto,fileic,filespm,course_id,student_dob,\r\n        temp_password,year_id,session_id,organization_id,applicant_id)\r\n        {$sqlapplicant}";
             $querystudent = $this->xoopsDB->query($sqlstudent);
             if (!$querystudent) {
                 $this->warningtxt = "Failed To Generate Student (Insert Student Record)";
                 return false;
             } else {
                 //if success move file
                 $filephoto = $this->getFileName($id, "filephoto");
                 $fileic = $this->getFileName($id, "fileic");
                 $filespm = $this->getFileName($id, "filespm");
                 copy("{$imageonlinepath}/{$filephoto}", "../hes/upload/student/{$filephoto}");
                 copy("{$imageonlinepath}/{$fileic}", "../hes/upload/student/{$fileic}");
                 copy("{$imageonlinepath}/{$filespm}", "../hes/upload/student/{$filespm}");
                 copy("{$imageonlinepath}/{$fileothers}", "../hes/upload/student/{$fileothers}");
                 //end of copy file
                 $student_newid = $this->getLatestStudentID();
                 $sqlspmonline = "select '{$timestamp}' as created,{$this->updatedby} as createdby,'{$timestamp}' as updated,{$this->updatedby} as updatedby,\r\n            {$student_newid} as student_id,subjectspm_id,gradelevel_id\r\n            from {$this->tablestudentspmonline} where student_id = {$id} ";
                 $sqlspm = "insert into {$this->tablestudentspm} (created,createdby,updated,updatedby,student_id,subjectspm_id,gradelevel_id)\r\n            {$sqlspmonline} ";
                 $queryspm = $this->xoopsDB->query($sqlspm);
                 if (!$queryspm) {
                     $this->warningtxt = "Failed To Generate Student (Insert SPM Record)";
                     return false;
                 }
                 $sql = "update {$this->tablestudentonline} set\r\n            isstudentcreate = 1,\r\n            matrix_no = '{$matrix_no}',\r\n            temp_password = '******'\r\n            where student_id = {$id} ";
                 $this->changesql .= $sql;
                 $query = $this->xoopsDB->query($sql);
                 if (!$query) {
                     $this->warningtxt = "Failed To Generate Student (Update Status Applicant)";
                     return false;
                 } else {
                 }
             }
         }
     }
     $this->warningtxt = "Successfully Generated Student";
     return true;
 }