示例#1
1
 public function saveGroupline()
 {
     $this->log->showLog(2, "Access saveGroupline");
     include "../simantz/class/nitobi.xml.php";
     include_once "../simantz/class/Save_Data.inc.php";
     global $xoopsDB, $xoopsUser;
     $saveHandler = new EBASaveHandler();
     $saveHandler->ProcessRecords();
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $uid = $xoopsUser->getVar('uid');
     $organization_id = $this->defaultorganization_id;
     $tablename = "sim_groups_users_link";
     $save = new Save_Data();
     $insertCount = $saveHandler->ReturnInsertCount();
     $this->log->showLog(3, "Start Insert({$insertCount} records)");
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         // Yes there are UPDATEs to perform...
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $isselect = $saveHandler->ReturnUpdateField($currentRecord, "selectrow");
             $glid = $saveHandler->ReturnUpdateField($currentRecord, "linkid");
             $cuid = $saveHandler->ReturnUpdateField($currentRecord, "uid");
             $cgroupid = $saveHandler->ReturnUpdateField($currentRecord, "groupid");
             $this->log->showLog(4, "Record:{$cuid},{$cgroupid},{$glid},{$isselect}");
             if ($isselect == 0) {
                 $save->DeleteRecord($tablename, "linkid", $glid, "", 1);
             } else {
                 $arrfield = array("uid", "groupid");
                 $arrfieldtype = array('%d', '%d');
                 $arrvalue = array($cuid, $cgroupid);
                 $save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "uid");
             }
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
         }
     }
     if ($this->failfeedback != "") {
         $this->failfeedback = "Warning!<br/>\n" . $this->failfeedback;
     }
     $saveHandler->setErrorMessage($this->failfeedback);
     $saveHandler->CompleteSave();
 }
 /**
  *
  * @return bool
  * @access public
  */
 public function insertOrganization()
 {
     $this->log->showLog(2, "Access insertOrganization");
     $timestamp = date("y/m/d H:i:s", time());
     include_once XOOPS_ROOT_PATH . "/modules/simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrfield = array("organization_name", "organization_code", "street1", "street2", "street3", "postcode", "city", "state", "country_id", "tel_1", "tel_2", "fax", "url", "email", "isactive", "created", "createdby", "updated", "updatedby", "seqno", "groupid", "currency_id", "companyno", "companyname", "description");
     $arrfieldtype = array("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%d", "%s", "%s", "%s", "%s", "%s", "%d", "%s", "%d", "%s", "%d", "%d", "%d", "%d", "%s", "%s", "%s");
     $arrvalue = array($this->organization_name, $this->organization_code, $this->street1, $this->street2, $this->street3, $this->postcode, $this->city, $this->state, $this->country_id, $this->tel_1, $this->tel_2, $this->fax, $this->url, $this->email, $this->isactive, $timestamp, $this->createdby, $timestamp, $this->updatedby, $this->seqno, $this->groupid, $this->currency_id, $this->companyno, $this->companyname, $this->description);
     $controlvalue = $this->organization_code;
     if ($save->InsertRecord($this->tableorganization, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "organization_id")) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Save new bankreconcilation into database
  *
  * @return bool
  * @access public
  */
 public function insertBankReconcilation()
 {
     global $selectspliter;
     include include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->tablename = $this->tablebankreconcilation;
     $primarykeyfieldname = "bankreconcilation_id";
     $primarykeyvalue = $this->bankreconcilation_id;
     $controlvalue = $this->bankreconcilationno;
     $this->created = date("y/m/d H:i:s", time());
     $this->updated = date("y/m/d H:i:s", time());
     $arrInsertField = array("created", "createdby", "updated", "updatedby", "statementbalance", "differenceamt", "accounts_id", "organization_id", "laststatementdate", "bankreconcilationno", "bankreconcilationdate", "iscomplete", "account_balance", "laststatementbalance", "period_id", "reconcilamt", "unreconcilamt");
     $arrInsertFieldType = array("%s", "%d", "%s", "%d", "%d", "%d", "%d", "%d", "%s", "%s", "%s", "%d", "%d", "%d", "%d", "%d", "%d");
     $arrvalue = array($this->created, createdby, $this->updated, $this->updatedby, $this->statementbalance, $this->differenceamt, $this->accounts_id, $this->organization_id, $this->laststatementdate, $this->bankreconcilationno, $this->bankreconcilationdate, $this->iscomplete, $this->account_balance, $this->laststatementbalance, $this->period_id, $this->reconcilamt, $this->unreconcilamt);
     if ($save->InsertRecord($this->tablename, $arrInsertField, $arrvalue, $arrInsertFieldType, $this->accounts_name, $primarykeyfieldname)) {
         $this->accounts_id = $save->latestid;
         return true;
     } else {
         return false;
     }
 }
示例#4
0
 /**
  * Save new year into database
  *
  * @return bool
  * @access public
  */
 public function insertYear()
 {
     include "../simantz/class/Save_Data.inc.php";
     $timestamp = date("y/m/d H:i:s", time());
     $save = new Save_Data();
     $arrvalue = array($this->year_description, $this->year_name, $this->isactive, $timestamp, $this->createdby, $timestamp, $this->updatedby);
     return $save->InsertRecord($this->tablename, $this->arrInsertField, $arrvalue, $this->arrInsertFieldType, $this->year_name, "year_id");
 }
示例#5
0
 public function insertWorkflow()
 {
     global $defaultorganization_id;
     include "../class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrvalue = array($this->workflownode_id, $this->workflow_id, $this->sequence_no, $this->parentnode_id, $this->workflowstatus_id, $this->workflowuserchoice_id, $this->target_groupid, $this->target_uid, $this->targetparameter_name, $this->email_list, $this->sms_list, $this->workflow_procedure, $this->email_body, $this->sms_body, $this->isemail, $this->issms, $this->workflow_description, $this->parameter_used, $this->updated, $this->updatedby, $this->updated, $this->updatedby, $this->isactive, $defaultorganization_id, $this->workflow_sql, $this->workflow_bypass, $this->hyperlink, $this->issubmit_node, $this->iscomplete_node);
     $save->InsertRecord($this->tablename, $this->arrInsertField, $arrvalue, $this->arrInsertFieldType, $this->sequence_no, "workflownode_id");
 }
示例#6
0
    public function duplicateQuotation()
    {
        $oldqid = $this->quotation_id;
        $query = $this->xoopsDB->query("SELECT * FROM  sim_bpartner_quotation q where q.quotation_id={$this->quotation_id}");
        while ($row = $this->xoopsDB->fetchArray($query)) {
            $this->document_no = $this->getNextNo();
            $this->organization_id = $row['organization_id'];
            $this->documenttype = $row['documenttype'];
            $this->document_date = date("Y-m-d", time());
            $this->currency_id = $row['currency_id'];
            $this->exchangerate = $row['exchangerate'];
            $this->subtotal = $row['subtotal'];
            $this->itemqty = $row['itemqty'];
            $this->ref_no = $row['ref_no'];
            $this->description = $row['description'];
            $this->bpartner_id = $row['bpartner_id'];
            $this->spquotation_prefix = $row['spquotation_prefix'];
            $this->issotrx = $row['issotrx'];
            $this->terms_id = $row['terms_id'];
            $this->contacts_id = $row['contacts_id'];
            $this->preparedbyuid = $row['preparedbyuid'];
            $this->salesagentname = $row['salesagentname'];
            $this->isprinted = $row['isprinted'];
            $this->localamt = $row['localamt'];
            $this->address_text = $row['address_text'];
            $this->address_id = $row['address_id'];
            $this->note = $row['note'];
            $this->quotation_title = $row['quotation_title'];
            $this->quotation_status = $row['quotation_status'];
            $this->iscomplete = 0;
            $qid = $this->insertQuotation();
            $this->log->showLog(2, "Generated quotation id: {$qid}");
            include_once "../simantz/class/Save_Data.inc.php";
            $save = new Save_Data();
            if ($qid > 0) {
                global $timestamp, $createdby;
                $sqlline = "SELECT * FROM  sim_bpartner_quotationline q where q.quotation_id={$oldqid}";
                $this->log->showLog(4, "Generated quotationline SQL: {$sqlline}");
                $queryline = $this->xoopsDB->query($sqlline);
                $arrInsertField = array("seqno", "subject", "description", "uprice", "qty", "uom", "amt", "quotation_id", "created", "createdby", "updated", "updatedby");
                $arrInsertFieldType = array("%d", "%s", "%s", "%f", "%f", "%s", "%f", "%d", "%s", "%d", "%s", "%d");
                $this->log->showLog(2, "before insert quotationline");
                while ($row = $this->xoopsDB->fetchArray($queryline)) {
                    $arrvalue = array($row["seqno"], $row["subject"], $row["description"], $row["uprice"], $row["qty"], $row["uom"], $row["amt"], $qid, $timestamp, $createdby, $timestamp, $createdby);
                    $controlvalue = $row["subject"];
                    $this->log->showLog(2, "before insert quotationline");
                    $save->InsertRecord("sim_bpartner_quotationline", $arrInsertField, $arrvalue, $arrInsertFieldType, $controlvalue, "quotationline_id");
                    // Now we execute this query
                }
            }
            echo <<<EOF
<div class="dimBackground"></div>
<div align="center" >
<div style="height:45px"  class="floatWindow" id="tblSub">
<table>
 <tr>
  <td astyle="vertical-align:middle;" align="center">

    <table class="" style="width:850px">

       <tr class="tdListRightTitle" >
          <td colspan="4">
                <table><tr>
                <td id="idHeaderText" align="center">Duplicate</td>
                <td align="right" width="30px"><img src="../simbiz/images/close.png" onclick="closeWindow();" style="cursor:pointer" title="Close"></td>
                </tr></table>
          </td>
       </tr>
\t\t\t<td>Record duplicated successfully, new quotation is: <a href="salesquotation.php?action=edit&quotation_id={$qid}"> {$this->spquotation_prefix} {$this->document_no}</a></td>
       <tr>
      </table>
</div></div>
EOF;
            return array($qid, $this->spquotation_prefix . $this->document_no);
        }
        echo <<<EOF
<div class="dimBackground"></div>
<div align="center" >
<div style="height:480px;overflow:auto;"  class="floatWindow" id="tblSub">
<table>
 <tr>
  <td astyle="vertical-align:middle;" align="center">

    <table class="" style="width:800px">

       <tr class="tdListRightTitle" >
          <td colspan="4">
                <table><tr>
                <td id="idHeaderText" align="center">Duplicate</td>
                <td align="right" width="30px"><img src="../simbiz/images/close.png" onclick="closeWindow();" style="cursor:pointer" title="Close"></td>
                </tr></table>
          </td>
       </tr>
\t\t\t<td>cannot duplicate this quotation due to sql error</td>
       <tr>
      </table>
</div></div>
EOF;
        EOF;
        return array(0, "");
        //sim_bpartner_quotationline
    }
 public function insertWorkflowHistory($workflowtransaction_feedback, $workflowtransaction_id)
 {
     global $xoopsUser;
     $uid = $xoopsUser->getVar('uid');
     include_once "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     if ($workflowtransaction_id == "") {
         $workflowtransaction_id = $this->getLatestWorkflowTransactionID();
     }
     //for history
     $arrInsertField = array('workflowtransaction_id', 'workflowstatus_id', 'workflowtransaction_datetime', 'uid', 'workflowtransactionhistory_description');
     $arrInsertFieldType = array('%d', '%d', '%s', '%d', '%s');
     $arrvalue = array($workflowtransaction_id, $this->workflowstatus_id, date("y/m/d H:i:s", time()), $uid, $workflowtransaction_feedback);
     return $save->InsertRecord('sim_workflowtransactionhistory', $arrInsertField, $arrvalue, $arrInsertFieldType, $tablename, "workflowtransactionhistory_id");
 }
示例#8
0
 /**
  * Save new bpartner into database
  *
  * @return bool
  * @access public
  */
 public function insertBPartner()
 {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     //do your sql insert here using $this->employee_name method : return boolean true or false
     global $xoopsDB, $xoopsUser;
     $joindate = date("Y-m-d", time());
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $this->updatedby = $xoopsUser->getVar('uid');
     $tablename = "sim_bpartner";
     if ($this->bpartner_id > 0) {
         //do update sql here
         $this->arrUpdateField = array("employeecount,alternatename,companyno,industry_id,tooltips,\r\n                            bpartnergroup_id,bpartner_no,bpartner_name,isactive,bpartner_url,\r\n\r\n                            description,currency_id,terms_id,organization_id,defaultlevel,\r\n                            updated,updatedby");
         $this->arrUpdateFieldType = array("%d", "%s", "%s", "%d", "%s", "%d", "%s", "%s", "%d", "%s", "%s", "%d", "%d", "%d", "%d", "%s", "%d", "%d");
         $arrvalue = array($this->employeecount, $this->alternatename, $this->companyno, $this->industry_id, $this->tooltips, $this->bpartnergroup_id, $this->bpartner_no, $this->bpartner_name, $this->isactive, $this->bpartner_url, $this->description, 0, 0, $this->organization_id, $this->defaultlevel, $this->updated, $this->updatedby);
         return $save->UpdateRecord($tablename, "bpartner_id", $this->bpartner_id, $this->arrUpdateField, $arrvalue, $this->arrUpdateFieldType, $this->bpartner_no);
     } else {
         //do insert sql here
         $this->arrInsertField = array("employeecount,alternatename,companyno,industry_id,tooltips,\r\n                            bpartnergroup_id,bpartner_no,bpartner_name,isactive,bpartner_url,\r\n\r\n                            description,currency_id,terms_id,organization_id,defaultlevel,\r\n                            created,createdby,updated,updatedby");
         $this->arrInsertFieldType = array("%d", "%s", "%s", "%d", "%s", "%d", "%s", "%s", "%d", "%s", "%s", "%d", "%d", "%d", "%d", "%s", "%d", "%s", "%d", "%d");
         $arrvalue = array($this->employeecount, $this->alternatename, $this->companyno, $this->industry_id, $this->tooltips, $this->bpartnergroup_id, $this->bpartner_no, $this->bpartner_name, $this->isactive, $this->bpartner_url, $this->description, 0, 0, $this->organization_id, $this->defaultlevel, $this->created, $this->createdby, $this->updated, $this->updatedby);
         return $save->InsertRecord($tablename, $this->arrInsertField, $arrvalue, $this->arrInsertFieldType, $this->bpartner_name, "bpartner_id");
     }
 }
示例#9
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;
 }
示例#10
0
 public function insertAccounts()
 {
     global $selectspliter;
     include include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrInsertField = array('accounts_name', 'created', 'createdby', 'updated', 'updatedby', 'defaultlevel', 'organization_id', 'description', 'parentaccounts_id', 'account_type', 'tax_id', 'placeholder', 'accountgroup_id', 'accountcode_full', 'ishide');
     $arrInsertFieldType = array('%s', '%s', '%d', '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d');
     $arrvalue = array($this->accounts_name, $this->updated, $this->updatedby, $this->updated, $this->updatedby, $this->defaultlevel, $this->organization_id, $this->description, $this->parentaccounts_id . $selectspliter . $this->parentaccounts_idname, $this->account_type . $selectspliter . $this->account_typename, $this->tax_id, $this->placeholder, $this->accountgroup_id . $selectspliter . $this->accountgroup_idname, $this->accountcode_full, $this->ishide);
     if ($save->InsertRecord($this->tablename, $arrInsertField, $arrvalue, $arrInsertFieldType, $this->accounts_name, "accounts_id")) {
         $this->accounts_id = $save->latestid;
         return true;
     } else {
         return false;
     }
 }
示例#11
0
 public function generatePeriod()
 {
     $this->log->showLog(2, "Access generatePeriod");
     include_once "../simantz/class/Save_Data.inc.php";
     global $xoopsDB, $xoopsUser, $selectspliter;
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $organization_id = $this->defaultorganization_id;
     $tablename = "sim_period";
     $save = new Save_Data();
     $arrfield = array("period_name", "period_year", "period_month", "isactive", "seqno", "created", "createdby", "updated", "updatedby");
     $arrfieldtype = array('%s', '%d', '%d', '%d', '%d', '%s', '%d', '%s', '%d');
     $period_month = 1;
     // Yes there are INSERTs to perform...
     while ($period_month < 13) {
         if ($period_month < 10) {
             $period_month = "0" . $period_month;
         }
         $period_name = $this->generateYear . "-" . $period_month;
         $arrvalue = array($period_name, $this->generateYear, $period_month, 1, 10, $timestamp, $createdby, $timestamp, $createdby);
         $controlvalue = $period_name;
         $save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "period_id");
         //  if($save->failfeedback!=""){
         //      $save->failfeedback = str_replace($this->failfeedback,"",$save->failfeedback);
         //      $this->failfeedback.=$save->failfeedback;
         //  }
         $period_month++;
         // Now we execute this query
     }
 }
示例#12
0
 public function saveFollowUpLayer()
 {
     global $xoopsUser, $xoopsDB;
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     //do your sql insert here using $this->employee_name method : return boolean true or false
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $this->updatedby = $xoopsUser->getVar('uid');
     $tablename = "sim_followup";
     if ($_POST['followup_id'] > 0) {
         $arrfield = array("issuedate", "followup_name", "followuptype_id", "nextfollowupdate", "contactperson", "contactnumber", "description", "updated", "updatedby", "isactive", "employee_name");
         $arrfieldtype = array('%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s');
         $controlvalue = $_POST["followup_name"];
         if ($_POST['isactive'] == "on") {
             $isactive = 1;
         } else {
             $isactive = 0;
         }
         $arrvalue = array($_POST["issuedate"], $_POST["followup_name"], $_POST["followuptype_id"], $_POST["nextfollowupdate"], $_POST["contactperson"], $_POST["contactnumber"], $_POST["description"], $timestamp, $createdby, $isactive, $_POST['employee_name']);
         if ($save->UpdateRecord($tablename, "followup_id", $_POST['followup_id'], $arrfield, $arrvalue, $arrfieldtype, $controlvalue)) {
             $arr = array("msg" => "Record save successfully", "status" => 1);
             echo json_encode($arr);
         } else {
             $arr = array("msg" => "Cannot save record", "status" => 0);
             echo json_encode($arr);
         }
     } else {
         $arrfield = array("issuedate", "followup_name", "followuptype_id", "nextfollowupdate", "contactperson", "contactnumber", "description", "created", "createdby", "updated", "updatedby", "isactive", "employee_name", "bpartner_id");
         $arrfieldtype = array('%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%d');
         $controlvalue = $_POST["followup_name"];
         if ($_POST['isactive'] == "on") {
             $isactive = 1;
         } else {
             $isactive = 0;
         }
         $arrvalue = array($_POST["issuedate"], $_POST["followup_name"], $_POST["followuptype_id"], $_POST["nextfollowupdate"], $_POST["contactperson"], $_POST["contactnumber"], $_POST["description"], $timestamp, $createdby, $timestamp, $createdby, $isactive, $_POST['employee_name'], $_POST['bpartner_id']);
         if ($save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $_POST["followup_name"], "followup_id")) {
             $arr = array("msg" => "Record save successfully", "status" => 1);
             echo json_encode($arr);
         } else {
             $arr = array("msg" => "Cannot save record", "status" => 0);
             echo json_encode($arr);
         }
     }
 }
示例#13
0
 public function saveInvoiceLine()
 {
     $this->log->showLog(3, "Access saveInvoiceLine");
     include "../simantz/class/nitobi.xml.php";
     include_once "../simantz/class/Save_Data.inc.php";
     global $xoopsDB, $xoopsUser;
     $saveHandler = new EBASaveHandler();
     $saveHandler->ProcessRecords();
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $uid = $xoopsUser->getVar('uid');
     $tablename = "sim_simbiz_invoiceline";
     $save = new Save_Data();
     $insertCount = $saveHandler->ReturnInsertCount();
     $this->log->showLog(3, "Start Insert({$insertCount} records)");
     if ($insertCount > 0) {
         $arrInsertField = array("seqno", "subject", "description", "accounts_id", "uprice", "qty", "uom", "tax_id", "branch_id", "track1_id", "track2_id", "track3_id", "amt", "invoice_id", "gstamt", "granttotalamt", "created", "createdby", "updated", "updatedby");
         $arrInsertFieldType = array("%d", "%s", "%s", "%d", "%f", "%f", "%s", "%d", "%d", "%s", "%s", "%s", "%f", "%d", "%f", "%f", "%s", "%d", "%s", "%d");
         // Yes there are INSERTs to perform...
         for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnInsertField($currentRecord, "seqno"), $saveHandler->ReturnInsertField($currentRecord, "subject"), $saveHandler->ReturnInsertField($currentRecord, "description"), $saveHandler->ReturnInsertField($currentRecord, "accounts_id"), $saveHandler->ReturnInsertField($currentRecord, "uprice"), $saveHandler->ReturnInsertField($currentRecord, "qty"), $saveHandler->ReturnInsertField($currentRecord, "uom"), $saveHandler->ReturnInsertField($currentRecord, "tax_id"), $saveHandler->ReturnInsertField($currentRecord, "branch_id"), $saveHandler->ReturnInsertField($currentRecord, "track1_id"), $saveHandler->ReturnInsertField($currentRecord, "track2_id"), $saveHandler->ReturnInsertField($currentRecord, "track3_id"), $saveHandler->ReturnInsertField($currentRecord, "amt"), $saveHandler->ReturnInsertField($currentRecord, "invoice_id"), $saveHandler->ReturnInsertField($currentRecord, "gstamt"), $saveHandler->ReturnInsertField($currentRecord, "granttotalamt"), $timestamp, $createdby, $timestamp, $createdby);
             $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "subject");
             $save->InsertRecord($tablename, $arrInsertField, $arrvalue, $arrInsertFieldType, $controlvalue, "invoiceline_id");
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
             // Now we execute this query
         }
     }
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         $arrUpdateField = array("seqno", "subject", "description", "accounts_id", "uprice", "qty", "uom", "tax_id", "branch_id", "track1_id", "track2_id", "track3_id", "amt", "gstamt", "granttotalamt", "updated", "updatedby");
         $arrUpdateFieldType = array("%d", "%s", "%s", "%d", "%f", "%f", "%s", "%d", "%d", "%s", "%s", "%s", "%f", "%f", "%f", "%s", "%d");
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, "seqno"), $saveHandler->ReturnUpdateField($currentRecord, "subject"), $saveHandler->ReturnUpdateField($currentRecord, "description"), $saveHandler->ReturnUpdateField($currentRecord, "accounts_id"), $saveHandler->ReturnUpdateField($currentRecord, "uprice"), $saveHandler->ReturnUpdateField($currentRecord, "qty"), $saveHandler->ReturnUpdateField($currentRecord, "uom"), $saveHandler->ReturnUpdateField($currentRecord, "tax_id"), $saveHandler->ReturnUpdateField($currentRecord, "branch_id"), $saveHandler->ReturnUpdateField($currentRecord, "track1_id"), $saveHandler->ReturnUpdateField($currentRecord, "track2_id"), $saveHandler->ReturnUpdateField($currentRecord, "track3_id"), $saveHandler->ReturnUpdateField($currentRecord, "amt"), $saveHandler->ReturnUpdateField($currentRecord, "gstamt"), $saveHandler->ReturnUpdateField($currentRecord, "granttotalamt"), $timestamp, $createdby);
             $this->log->showLog(3, "***updating record({$currentRecord}), invoiceline:subject" . $saveHandler->ReturnUpdateField($currentRecord, "subject"));
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "subject");
             $save->UpdateRecord($tablename, "invoiceline_id", $saveHandler->ReturnUpdateField($currentRecord, "invoiceline_id"), $arrUpdateField, $arrvalue, $arrUpdateFieldType, $controlvalue);
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
         }
     }
     $ispurge = 0;
     $deleteCount = $saveHandler->ReturnDeleteCount();
     $this->log->showLog(3, "Start delete/purge({$deleteCount} records)");
     if ($deleteCount > 0) {
         for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) {
             $record_id = $saveHandler->ReturnDeleteField($currentRecord);
             $this->log->showLog(3, "delete: {$currentRecord},{$record_id}");
             $controlvalue = $this->getInvoiceLineSubject($record_id);
             $save->DeleteRecord("sim_simbiz_invoiceline", "invoiceline_id", $record_id, $controlvalue, 1);
         }
     }
     if ($this->failfeedback != "") {
         $this->failfeedback = "Warning!<br/>\n" . $this->failfeedback;
     }
     $saveHandler->setErrorMessage($this->failfeedback);
     $saveHandler->CompleteSave();
 }
示例#14
0
 public function saveRegion()
 {
     $this->log->showLog(2, "Access saveRegion");
     include "../simantz/class/nitobi.xml.php";
     include_once "../simantz/class/Save_Data.inc.php";
     global $xoopsDB, $xoopsUser;
     $saveHandler = new EBASaveHandler();
     $saveHandler->ProcessRecords();
     $timestamp = date("Y-m-d H:i:s", time());
     $createdby = $xoopsUser->getVar('uid');
     $uname = $xoopsUser->getVar('uname');
     $uid = $xoopsUser->getVar('uid');
     $organization_id = $this->defaultorganization_id;
     $tablename = "sim_region";
     $save = new Save_Data();
     $insertCount = $saveHandler->ReturnInsertCount();
     $this->log->showLog(3, "Start Insert({$insertCount} records)");
     if ($insertCount > 0) {
         $arrfield = array("country_id", "region_name", "isactive", "seqno", "created", "createdby", "updated", "updatedby", "organization_id");
         $arrfieldtype = array('%d', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d');
         // Yes there are INSERTs to perform...
         for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnInsertField($currentRecord, "country_id"), $saveHandler->ReturnInsertField($currentRecord, "region_name"), $saveHandler->ReturnInsertField($currentRecord, "isactive"), $saveHandler->ReturnInsertField($currentRecord, "seqno"), $timestamp, $createdby, $timestamp, $createdby, $organization_id);
             $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "region_name");
             $save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "region_name");
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
             // Now we execute this query
         }
     }
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         $arrfield = array("region_name", "isactive", "seqno", "updated", "updatedby");
         $arrfieldtype = array('%s', '%d', '%d', '%s', '%d');
         // Yes there are UPDATEs to perform...
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $this->log->showLog(3, "***updating record({$currentRecord}),new region_name:" . $saveHandler->ReturnUpdateField($currentRecord, "region_name") . ",id:" . $saveHandler->ReturnUpdateField($currentRecord, "region_id") . "\n");
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "region_name");
         }
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, "region_name"), $saveHandler->ReturnUpdateField($currentRecord, "isactive"), $saveHandler->ReturnUpdateField($currentRecord, "seqno"), $timestamp, $createdby);
             $this->log->showLog(3, "***updating record({$currentRecord}),new region_name:" . $saveHandler->ReturnUpdateField($currentRecord, "region_name") . ",id:" . $saveHandler->ReturnUpdateField($currentRecord, "region_id") . "\n");
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "region_name");
             $save->UpdateRecord($tablename, "region_id", $saveHandler->ReturnUpdateField($currentRecord, "region_id"), $arrfield, $arrvalue, $arrfieldtype, $controlvalue);
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
         }
     }
     $ispurge = 0;
     $deleteCount = $saveHandler->ReturnDeleteCount();
     $this->log->showLog(3, "Start delete/purge({$deleteCount} records)");
     //include "class/Country.inc.php";
     //$o = new Country();
     if ($deleteCount > 0) {
         for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) {
             $record_id = $saveHandler->ReturnDeleteField($currentRecord);
             $this->fetchRegion($record_id);
             $controlvalue = $this->region_name;
             $isdeleted = $this->isdeleted;
             $save->DeleteRecord("sim_region", "region_id", $record_id, $controlvalue, 1);
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
         }
     }
     if ($this->failfeedback != "") {
         $this->failfeedback = "Warning!<br/>\n" . $this->failfeedback;
     }
     $saveHandler->setErrorMessage($this->failfeedback);
     $saveHandler->CompleteSave();
 }
示例#15
0
 /**
  * Save new batch into database
  *
  * @return bool
  * @access public
  */
 public function insertBatch()
 {
     global $selectspliter;
     include include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->tablename = $this->tablebatch;
     $primarykeyfieldname = "batch_id";
     $primarykeyvalue = $this->batch_id;
     $controlvalue = $this->batchno;
     $this->created = date("y/m/d H:i:s", time());
     $this->updated = date("y/m/d H:i:s", time());
     $arrInsertField = array("batch_name", "reuse", "created", "createdby", "updated", "updatedby", "totaldebit", "totalcredit", "period_id", "organization_id", "description", "batchno", "batchdate", "iscomplete");
     $arrInsertFieldType = array("%s", "%d", "%s", "%d", "%s", "%d", "%d", "%d", "%d", "%d", "%s", "%d", "%s", "%d");
     $arrvalue = array($this->batch_name, $this->reuse, $this->created, $this->createdby, $this->updated, $this->updatedby, $this->totaldebit, $this->totalcredit, $this->period_id, $this->organization_id, $this->description, $this->batchno, $this->batchdate, $this->iscomplete);
     if ($save->InsertRecord($this->tablename, $arrInsertField, $arrvalue, $arrInsertFieldType, $this->accounts_name, $primarykeyfieldname)) {
         $this->accounts_id = $save->latestid;
         return true;
     } else {
         return false;
     }
 }
 public function insertPaymentLine($currentRecord, $saveHandler)
 {
     $this->log->showLog(3, "access insertPaymentLine({$currentRecord})");
     include_once "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     global $xoopsDB, $xoopsUser, $timestamp, $createdby, $uname, $uid;
     $tablename = "sim_simbiz_paymentline";
     $arrInsertField = array("description", "accounts_id", "tax_id", "branch_id", "track1_id", "track2_id", "track3_id", "amt", "payment_id", "invoice_id", "chequeno", "created", "createdby", "updated", "updatedby");
     $arrInsertFieldType = array("%s", "%d", "%d", "%d", "%s", "%s", "%s", "%f", "%d", "%d", "%s", "%s", "%d", "%s", "%d");
     // Yes there are INSERTs to perform...
     $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, "description"), $saveHandler->ReturnUpdateField($currentRecord, "accounts_id"), $saveHandler->ReturnUpdateField($currentRecord, "tax_id"), $saveHandler->ReturnUpdateField($currentRecord, "branch_id"), $saveHandler->ReturnUpdateField($currentRecord, "track1_id"), $saveHandler->ReturnUpdateField($currentRecord, "track2_id"), $saveHandler->ReturnUpdateField($currentRecord, "track3_id"), $saveHandler->ReturnUpdateField($currentRecord, "amt"), $saveHandler->ReturnUpdateField($currentRecord, "payment_id"), $saveHandler->ReturnUpdateField($currentRecord, "invoice_id"), $saveHandler->ReturnUpdateField($currentRecord, "chequeno"), $timestamp, $createdby, $timestamp, $createdby);
     $arra = print_r($arrvalue, true);
     $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "invoice_no");
     $this->log->showLog(4, "insertPaymentLine controlvalue:{$controlvalue}:, with array:{$arra}");
     $save->InsertRecord($tablename, $arrInsertField, $arrvalue, $arrInsertFieldType, $controlvalue, "paymentline_id");
     if ($save->failfeedback != "") {
         $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
         $this->failfeedback .= $save->failfeedback;
         // Now we execute this query
     }
 }
示例#17
0
 public function insertWindow()
 {
     include "../class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrvalue = array($this->mid, $this->windowsetting, $this->seqno, $this->description, $this->parentwindows_id, $this->filename, $this->isactive, $this->window_name, $this->updated, $this->updatedby, $this->updated, $this->updatedby, $this->table_name, $this->helpurl, $this->jrxml);
     $save->InsertRecord($this->tablename, $this->arrInsertField, $arrvalue, $this->arrInsertFieldType, $this->window_name, "window_id");
 }