Exemplo n.º 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();
 }
Exemplo n.º 2
0
 /**
  * Delete particular races id
  *
  * @param int races_id 
  * @return bool
  * @access public
  */
 public function deleteRaces($races_id)
 {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     return $save->DeleteRecord($this->tablename, "races_id", $races_id, $this->races_name, 1);
 }
Exemplo n.º 3
0
 public function deleteWorkflow($workflownode_id)
 {
     include "../class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->fetchWorkflow($workflownode_id);
     return $save->DeleteRecord($this->tablename, "workflownode_id", $workflownode_id, $this->workflowstatus_id, 1);
 }
Exemplo n.º 4
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");
     }
 }
Exemplo n.º 5
0
 $window_name = $_REQUEST['window_name'];
 $txt = $_REQUEST['txtsetting'];
 $jrxml = $_REQUEST['jrxml'];
 if (get_magic_quotes_gpc()) {
     $txt = stripslashes($txt);
     $jrxml = stripslashes($jrxml);
 }
 if ($_REQUEST['isactive'] == 'on') {
     $isactive = 1;
 } else {
     $isactive = 0;
 }
 $save = $_REQUEST['save'];
 if ($save == 1) {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrUpdateField = array('windowsetting', 'isactive', 'updated', 'updatedby', 'jrxml');
     $arrUpdateFieldType = array("%s", "%d", "%s", "%d", '%s');
     if (get_magic_quotes_gpc()) {
         $txt = stripslashes($txt);
         $jrxml = stripslashes($jrxml);
     }
     $arrvalue = array($txt, $isactive, date("Y-m-d H:i:s", time()), $xoopsUser->getVar('uid'), $jrxml);
     $save->UpdateRecord('sim_window', "window_id", $window_id, $arrUpdateField, $arrvalue, $arrUpdateFieldType, $window_name);
     //    return true;
     //else
     //  return false;
 }
 echo "<table>";
 eval($txt);
 echo "</table>";
Exemplo n.º 6
0
 public function deleteOrganization($organization_id)
 {
     $this->log->showLog(2, "Warning: Performing delete organization id : {$organization_id} !");
     include_once XOOPS_ROOT_PATH . "/modules/simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->fetchOrganization($organization_id);
     if (!$save->DeleteRecord($this->tableorganization, "organization_id", $organization_id, $this->organization_code, 1)) {
         $this->log->showLog(1, "Error: organization ({$organization_id}) cannot remove from database:" . mysql_error());
         return false;
     } else {
         $this->log->showLog(3, "Organization ({$organization_id}) removed from database successfully!");
         return true;
     }
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
 public function deleteAccounts($accounts_id)
 {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     if ($this->fetchAccounts($accounts_id)) {
         return $save->DeleteRecord($this->tablename, "accounts_id", $accounts_id, $this->accounts_name, 1);
     } else {
         return false;
     }
 }
Exemplo n.º 10
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);
         }
     }
 }
Exemplo n.º 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
     }
 }
Exemplo n.º 12
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();
 }
Exemplo n.º 13
0
<?php

include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/header.php';
include_once 'class/Log.inc.php';
include_once "class/Save_Data.inc.php";
//include_once("class/nitobi.xml.php");
include_once "class/EBAGetHandler.php";
include_once "setting.php";
$defaultorganization_id = $_SESSION['defaultorganization_id'];
$log = new Log();
$o = new Save_Data();
$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');
$isadmin = $xoopsUser->isAdmin();
$action = $_GET['action'];
if ($isadmin) {
    $log->showLog(3, "Current user is admin user");
}
//$log->cleanLog();
switch ($action) {
    case "country":
        $o->saveCountry();
        break;
    case "window":
        $o->saveWindow();
        break;
Exemplo n.º 14
0
<?php

include "system.php";
//include_once "../simantz/class/Permission.php";
include_once 'class/Batch.php';
include_once "../simantz/class/datepicker/class.datepicker.php";
include_once "../simantz/class/WorkflowAPI.inc.php";
include_once "../simantz/class/SelectCtrl.inc.php";
include_once "../simantz/class/Save_Data.inc.php";
$save = new Save_Data();
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$dp = new datepicker("{$url}");
$dp->dateFormat = 'Y-m-d';
$isadmin = $xoopsUser->isAdmin();
//$log = new Log();
$o = new Batch();
$s = new XoopsSecurity();
$ctrl = new SelectCtrl();
$o->rcode = date("YmdHis", time());
$_SESSION['sql_txt_' . $o->rcode] = "";
$orgctrl = "";
$action = "";
if (isset($_POST['action'])) {
    $action = $_POST['action'];
} elseif (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = "";
}
$token = $_POST['token'];
$reuse = $_REQUEST["reuse"];
Exemplo n.º 15
0
 /**
  * Delete particular year id
  *
  * @param int year_id
  * @return bool
  * @access public
  */
 public function deleteYear($year_id)
 {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     return $save->DeleteRecord($this->tablename, "year_id", $year_id, $this->year_name, 1);
 }
Exemplo n.º 16
0
 public function rollbackSubmitOperation($table_name, $field_name, $field_val, $field_update = "issubmit")
 {
     include_once "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $arrUpdateField = array($field_update);
     $arrUpdateFieldType = array("%d");
     $arrvalue = array("0");
     $this->log->showLog(4, " rollbackSubmitOperation with SQL: {$field_update}");
     return $save->UpdateRecord($table_name, $field_name, $field_val, $arrUpdateField, $arrvalue, $arrUpdateFieldType, $field_val);
 }
Exemplo n.º 17
0
 /**
  * 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;
     }
 }
Exemplo n.º 18
0
 /**
  * Delete particular batch id
  *
  * @param int batch_id 
  * @return bool
  * @access public
  */
 public function deleteBatch($batch_id)
 {
     include "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->tablename = $this->tableaccounts;
     $primarykeyvalue = $batch_id;
     $primarykeyname = "batch_id";
     $rs = $this->fetchBatch($batch_id);
     $controlvalue = $this->batchno;
     if ($rs) {
         return $save->DeleteRecord($this->tablename, $primarykeyname, $primarykeyvalue, $this->{$controlvalue}, 1);
     } else {
         return false;
     }
     $this->log->showLog(2, "Warning: Performing delete batch id : {$batch_id} !");
     $sql = "DELETE FROM {$this->tablebatch} where batch_id={$batch_id}";
     $this->log->showLog(4, "Delete SQL Statement: {$sql}");
     $rs = $this->xoopsDB->query($sql);
     if (!$rs) {
         $this->log->showLog(1, "Error: batch ({$batch_id}) cannot remove from database:" . mysql_error() . ":{$sql}");
         return false;
     } else {
         $this->log->showLog(3, "batch ({$batch_id}) removed from database successfully!");
         return true;
     }
 }
Exemplo n.º 19
0
 public function updateBPartnerBasicInfo()
 {
     global $xoopsDB, $saveHandler, $userid, $timestamp, $defaultorganization_id;
     $tablename = "sim_bpartner";
     $pkey = "bpartner_id";
     $keyword = "BPartner";
     $controlfieldname = "bpartner_no";
     $this->log->showLog(2, "Access into updateBPartnerBasicInfo() event");
     $arrfield = array($controlfieldname, "bpartner_name", "bpartnergroup_id", "industry_id", "companyno", "alternatename", "employeecount", "employee_id", "isdebtor", "iscreditor", "salespricelist_id", "purchasepricelist_id", "istransporter", "isdealer", "isprospect", "currency_id", "tooltips", "terms_id", "bpartner_url", "description", "isactive", "defaultlevel", "updated", "updatedby");
     $arrfieldtype = array('%s', '%s', '%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%s', '%s', '%d', '%d', '%s', '%d');
     // Yes there are UPDATEs to perform...
     $arrvalue = array($this->bpartner_no, $this->bpartner_name, $this->bpartnergroup_id, $this->industry_id, $this->companyno, $this->alternatename, $this->employeecount, $this->employee_id, $this->isdebtor, $this->iscreditor, $this->salespricelist_id, $this->purchasepricelist_id, $this->istransporter, $this->isdealer, $this->isprospect, $this->currency_id, $this->tooltips, $this->terms_id, $this->bpartner_url, $this->description, $this->isactive, $this->defaultlevel, $userid, $timestamp);
     $controlvalue = $this->bpartner_no;
     include_once "class/Save_Data.inc.php";
     $save = new Save_Data();
     if ($save->UpdateRecord($tablename, $pkey, $this->bpartner_id, $arrfield, $arrvalue, $arrfieldtype, $controlvalue)) {
         $this->errormessage = "";
         return true;
     } else {
         $this->errormessage = $save->failfeedback;
         return false;
     }
 }
Exemplo n.º 20
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
    }
Exemplo n.º 21
0
 public function deletePaymentLine($currentRecord, $saveHandler)
 {
     include_once "../simantz/class/Save_Data.inc.php";
     $save = new Save_Data();
     global $xoopsDB, $xoopsUser, $timestamp, $createdby, $uname, $uid;
     $tablename = "sim_simbiz_paymentline";
     $record_id = $saveHandler->ReturnUpdateField($currentRecord, "paymentline_id");
     $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "invoice_no");
     $this->log->showLog(3, "delete: {$currentRecord},{$record_id}");
     $save->DeleteRecord("sim_simbiz_paymentline", "paymentline_id", $record_id, $controlvalue, 1);
 }
Exemplo n.º 22
0
 public function deleteWindow($window_id)
 {
     include "../class/Save_Data.inc.php";
     $save = new Save_Data();
     $this->fetchWindow($window_id);
     return $save->DeleteRecord($this->tablename, "window_id", $window_id, $this->window_name, 1);
 }