예제 #1
0
        $myQuery = "INSERT INTO tblorders (CustomerID, ProductName, OrderDate, ShippedDate) VALUES (" . "'" . $saveHandler->ReturnForeignKeyValue($currentRecord) . "'," . "'" . $saveHandler->ReturnInsertField($currentRecord, "ProductName") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "OrderDate") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "ShippedDate") . "'" . "); ";
        // Now we execute this query
        mysql_query($myQuery);
    }
}
// ********************************************************** '
// Continue by processing our updates
// ********************************************************** '
$updateCount = $saveHandler->ReturnUpdateCount();
if ($updateCount > 0) {
    // Yes there are UPDATEs to perform...
    for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
        $myQuery = "UPDATE tblorders SET " . "ProductName\t\t= '" . $saveHandler->ReturnUpdateField($currentRecord, "ProductName") . "', " . "OrderDate\t\t\t= '" . $saveHandler->ReturnUpdateField($currentRecord, "OrderDate") . "', " . "ShippedDate\t\t\t= '" . $saveHandler->ReturnUpdateField($currentRecord, "ShippedDate") . "'" . "WHERE OrderID \t= " . $saveHandler->ReturnUpdateField($currentRecord) . "" . ";";
        // Now we execute this query
        mysql_query($myQuery);
    }
}
// ********************************************************** '
// Finish by processing our deletes
// ********************************************************** '
$deleteCount = $saveHandler->ReturnDeleteCount();
if ($deleteCount > 0) {
    // Yes there are DELETES to perform...
    for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) {
        $myQuery = "DELETE FROM tblorders WHERE OrderID = " . $saveHandler->ReturnDeleteField($currentRecord) . "";
        // Now we execute this query
        mysql_query($myQuery);
    }
}
$saveHandler->CompleteSave();
mysql_close();
예제 #2
0
 public function saveBatchline()
 {
     $this->log->showLog(3, "Access saveBatchline");
     include "../simantz/class/nitobi.xml.php";
     include_once "../simantz/class/Save_Data.inc.php";
     global $xoopsDB, $xoopsUser, $defcurrencycode_id;
     $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_transaction";
     $this->multiplyconversion = 1;
     $this->log->showLog(3, "Get batch_id:{$batch_id}");
     $save = new Save_Data();
     /* run update 1st */
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         $arrfield = array("document_no", "amt", "originalamt", "tax_id", "currency_id", "document_no2", "accounts_id", "multiplyconversion", "seqno", "bpartner_id", "isreconciled", "bankreconcilation_id", "transtype", "linedesc", "reconciledate", "branch_id", "track_id1", "track_id2", "track_id3", "created", "createdby", "row_typeline", "temp_parent_id");
         $arrfieldtype = array('%s', '%f', '%f', '%d', '%d', '%s', '%d', '%f', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d');
         // Yes there are UPDATEs to perform...
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $this->log->showLog(3, "***updating record({$currentRecord}),new batchline_details:" . $saveHandler->ReturnUpdateField($currentRecord, "batchline_details") . ",id:" . $saveHandler->ReturnUpdateField($currentRecord) . "\n");
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "batchline_details");
         }
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             //            $reference_id = 0;
             $row_typeline = $saveHandler->ReturnUpdateField($currentRecord, "row_typeline");
             $temp_parent_id = $saveHandler->ReturnUpdateField($currentRecord, "temp_parent_id");
             //            if($row_typeline == 2)
             //            $reference_id = $this->getLatestGridParentID($temp_parent_id);
             $amt = $saveHandler->ReturnUpdateField($currentRecord, "amt_debit");
             if ($saveHandler->ReturnUpdateField($currentRecord, "amt_credit") > 0) {
                 $amt = -1 * $saveHandler->ReturnUpdateField($currentRecord, "amt_credit");
             }
             $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, "document_no"), $amt, $amt, $saveHandler->ReturnUpdateField($currentRecord, "tax_cell"), $defcurrencycode_id, $saveHandler->ReturnUpdateField($currentRecord, "document_no2"), $saveHandler->ReturnUpdateField($currentRecord, "accounts_cell"), $this->multiplyconversion, $saveHandler->ReturnUpdateField($currentRecord, "seqno"), $saveHandler->ReturnUpdateField($currentRecord, "bpartner_cell"), $this->isreconciled, $this->bankreconcilation_id, $this->transtype, $saveHandler->ReturnUpdateField($currentRecord, "linedesc"), $this->reconciledate, $saveHandler->ReturnUpdateField($currentRecord, "organization_cell"), $saveHandler->ReturnUpdateField($currentRecord, "track1_cell"), $saveHandler->ReturnUpdateField($currentRecord, "track2_cell"), $saveHandler->ReturnUpdateField($currentRecord, "track3_cell"), $timestamp, $createdby, $row_typeline, $temp_parent_id);
             $this->log->showLog(3, "***updating record({$currentRecord}),new batchline_details:" . $saveHandler->ReturnUpdateField($currentRecord, "batchline_details") . ",id:" . $saveHandler->ReturnUpdateField($currentRecord, "batchline_id") . "\n");
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "trans_id");
             $save->UpdateRecord($tablename, "trans_id", $saveHandler->ReturnUpdateField($currentRecord, "trans_id"), $arrfield, $arrvalue, $arrfieldtype, $controlvalue);
             if ($save->failfeedback != "") {
                 $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                 $this->failfeedback .= $save->failfeedback;
             }
         }
     }
     /*run delete 1st*/
     $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->fetchDisciplineline($record_id);
             $controlvalue = $this->trans_id;
             $isdeleted = 1;
             $save->DeleteRecord("sim_simbiz_transaction", "trans_id", $record_id, $controlvalue, $isdeleted);
         }
     }
     /* start insert after update all row*/
     $insertCount = $saveHandler->ReturnInsertCount();
     $this->log->showLog(3, "Start Insert({$insertCount} records)");
     if ($insertCount > 0) {
         $arrfield = 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");
         $arrfieldtype = 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');
         // Yes there are INSERTs to perform... for parent
         for ($currentRecord = $insertCount - 1; $currentRecord >= 0; $currentRecord--) {
             $reference_id = 0;
             $row_typeline = $saveHandler->ReturnInsertField($currentRecord, "row_typeline");
             $temp_parent_id = $saveHandler->ReturnInsertField($currentRecord, "temp_parent_id");
             //         if($row_typeline == 2)
             //         $reference_id = $this->getLatestGridParentID($temp_parent_id);
             if ($row_typeline == 1) {
                 $amt = $saveHandler->ReturnInsertField($currentRecord, "amt_debit");
                 if ($saveHandler->ReturnInsertField($currentRecord, "amt_credit") > 0) {
                     $amt = -1 * $saveHandler->ReturnInsertField($currentRecord, "amt_credit");
                 }
                 $arrvalue = array($this->batch_id, $saveHandler->ReturnInsertField($currentRecord, "document_no"), $amt, $amt, $saveHandler->ReturnInsertField($currentRecord, "tax_cell"), $defcurrencycode_id, $saveHandler->ReturnInsertField($currentRecord, "document_no2"), $saveHandler->ReturnInsertField($currentRecord, "accounts_cell"), $this->multiplyconversion, $saveHandler->ReturnInsertField($currentRecord, "seqno"), $reference_id, $saveHandler->ReturnInsertField($currentRecord, "bpartner_cell"), $this->isreconciled, $this->bankreconcilation_id, $this->transtype, $saveHandler->ReturnInsertField($currentRecord, "linedesc"), $this->reconciledate, $saveHandler->ReturnInsertField($currentRecord, "organization_cell"), $saveHandler->ReturnInsertField($currentRecord, "track1_cell"), $saveHandler->ReturnInsertField($currentRecord, "track2_cell"), $saveHandler->ReturnInsertField($currentRecord, "track3_cell"), $timestamp, $createdby, $row_typeline, $temp_parent_id);
                 $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "trans_id");
                 $save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "trans_id");
                 if ($save->failfeedback != "") {
                     $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                     $this->failfeedback .= $save->failfeedback;
                 }
             }
             // Now we execute this query
         }
         // Yes there are INSERTs to perform... for child
         for ($currentRecord = $insertCount - 1; $currentRecord >= 0; $currentRecord--) {
             $reference_id = 0;
             $row_typeline = $saveHandler->ReturnInsertField($currentRecord, "row_typeline");
             $temp_parent_id = $saveHandler->ReturnInsertField($currentRecord, "temp_parent_id");
             if ($row_typeline == 2) {
                 $reference_id = $this->getLatestGridParentID($temp_parent_id);
             }
             if ($row_typeline == 2) {
                 $amt = $saveHandler->ReturnInsertField($currentRecord, "amt_debit");
                 if ($saveHandler->ReturnInsertField($currentRecord, "amt_credit") > 0) {
                     $amt = number_format(-1 * $saveHandler->ReturnInsertField($currentRecord, "amt_credit"), 2);
                 }
                 $arrvalue = array($this->batch_id, $saveHandler->ReturnInsertField($currentRecord, "document_no"), $amt, $amt, $saveHandler->ReturnInsertField($currentRecord, "tax_cell"), $defcurrencycode_id, $saveHandler->ReturnInsertField($currentRecord, "document_no2"), $saveHandler->ReturnInsertField($currentRecord, "accounts_cell"), $this->multiplyconversion, $saveHandler->ReturnInsertField($currentRecord, "seqno"), $reference_id, $saveHandler->ReturnInsertField($currentRecord, "bpartner_cell"), $this->isreconciled, $this->bankreconcilation_id, $this->transtype, $saveHandler->ReturnInsertField($currentRecord, "linedesc"), $this->reconciledate, $saveHandler->ReturnInsertField($currentRecord, "organization_cell"), $saveHandler->ReturnInsertField($currentRecord, "track1_cell"), $saveHandler->ReturnInsertField($currentRecord, "track2_cell"), $saveHandler->ReturnInsertField($currentRecord, "track3_cell"), $timestamp, $createdby, $row_typeline, $temp_parent_id);
                 $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "trans_id");
                 $save->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "trans_id");
                 if ($save->failfeedback != "") {
                     $save->failfeedback = str_replace($this->failfeedback, "", $save->failfeedback);
                     $this->failfeedback .= $save->failfeedback;
                 }
             }
             // Now we execute this query
         }
     }
     /* end insert */
     if ($this->failfeedback != "") {
         $this->failfeedback = "Warning!<br/>\n" . $this->failfeedback;
     }
     $saveHandler->setErrorMessage($this->failfeedback);
     $saveHandler->CompleteSave();
 }
예제 #3
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();
 }
예제 #4
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();
 }