Esempio 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();
 }
Esempio n. 2
0
<?php

header('Content-type: text/xml');
require "nitobi.xml.php";
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
// Make a MySQL Connection
mysql_connect() or die(mysql_error());
mysql_select_db("nitobi_testdb_v1") or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        $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);
    }
}
// ********************************************************** '
 public function savePaymentLine()
 {
     $this->log->showLog(3, "Access savePaymentLine");
     include "../simantz/class/nitobi.xml.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_paymentline";
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $paymentline_id = $saveHandler->ReturnUpdateField($currentRecord, "paymentline_id");
             $invoice_id = $saveHandler->ReturnUpdateField($currentRecord, "invoice_id");
             $amt = $saveHandler->ReturnUpdateField($currentRecord, "amt");
             $this->log->showLog(3, "update record({$currentRecord}): paymentline_id={$paymentline_id},invoice_id={$invoice_id},amt={$amt}");
             if ($paymentline_id > 0 && $amt == 0) {
                 $this->deletePaymentLine($currentRecord, $saveHandler);
             } elseif ($paymentline_id > 0 && $amt != 0) {
                 $this->updatePaymentLine($currentRecord, $saveHandler);
             } elseif ($paymentline_id == 0 && $amt != 0) {
                 $this->insertPaymentLine($currentRecord, $saveHandler);
             }
         }
     }
     $ispurge = 0;
     $deleteCount = $saveHandler->ReturnDeleteCount();
     $this->log->showLog(3, "Start delete/purge({$deleteCount} records)");
     if ($deleteCount > 0) {
     }
     if ($this->failfeedback != "") {
         $this->failfeedback = "Warning!<br/>\n" . $this->failfeedback;
     }
     $saveHandler->setErrorMessage($this->failfeedback);
     $saveHandler->CompleteSave();
 }
<?php

header('Content-type: text/xml');
require "nitobi.xml.php";
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
// Make a MySQL Connection
mysql_connect() or die(mysql_error());
mysql_select_db("nitobi_testdb_v1") or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        $myQuery = "INSERT INTO tblcustomers (CustomerName, ContactName, ContactEmail, PhoneNumber) VALUES (" . "'" . $saveHandler->ReturnInsertField($currentRecord) . "'," . "'" . $saveHandler->ReturnInsertField($currentRecord, "ContactName") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "ContactEmail") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "JobTitle") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "CompanyName") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "PhoneNumber") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "Address") . "' " . "); ";
        // Now we execute this query
        mysql_query($myQuery);
    }
}
// ********************************************************** '
Esempio n. 5
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();
 }
Esempio n. 6
0
<?php

header('Content-type: text/xml');
require "../../../../server/php/base_gethandler.php";
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
// Make a MySQL Connection
mysql_connect() or die(mysql_error());
mysql_select_db("nitobi_testdb_v1") or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        // NOTE: Because in this example we actually perform the database INSERT in the allocaterecord.asp
        // document, we only need to do an INSERT here. We do this to keep the primary key of the record
        // in sync with the grid.
        $myQuery = "UPDATE tblproducts SET " . "ProductName \t\t= '" . $saveHandler->ReturnInsertField($currentRecord, "ProductName") . "', " . "ProductCategoryName \t\t= '" . $saveHandler->ReturnInsertField($currentRecord, "ProductCategoryName") . "', " . "ProductSku \t\t\t= '" . $saveHandler->ReturnInsertField($currentRecord, "ProductSku") . "', " . "ProductPrice \t\t= '" . $saveHandler->ReturnInsertField($currentRecord, "ProductPrice") . "', " . "ProductQuantityPerUnit \t\t= '" . $saveHandler->ReturnInsertField($currentRecord, "ProductQuantityPerUnit") . "' " . "WHERE ProductID \t= '" . $saveHandler->ReturnInsertField($currentRecord) . "'" . ";";
        // Now we execute this query
        mysql_query($myQuery);
<?php

header('Content-type: text/xml');
require "nitobi.xml.php";
require "/*** NTB_CONNECTION_FILE ***/";
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
mysql_select_db() or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        $myQuery = "/*** NTB_INSERTSTATEMENT ***/";
        // Now we execute this query
        mysql_query($myQuery);
        /******
         * To properly edit a row after inserting, we need to send the key of the new
         * row back to the Grid.  We can do this using the EBASaveHandler_SetRecordKey function.
         *******/
Esempio n. 8
0
<?php

header('Content-type: text/xml');
require "../../../../server/php/base_gethandler.php";
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
// Make a MySQL Connection
mysql_connect('localhost', 'root', 'root') or die(mysql_error());
mysql_select_db("nitobi_testdb_v1") or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        $myQuery = "INSERT INTO tblcontacts3k (ContactID, ContactName, ContactEmail, JobTitle, CompanyName, PhoneNumber, Address) VALUES (" . "'" . $saveHandler->ReturnInsertField($currentRecord) . "'," . "'" . $saveHandler->ReturnInsertField($currentRecord, "ContactName") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "ContactEmail") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "JobTitle") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "CompanyName") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "PhoneNumber") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "Address") . "' " . "); ";
        // Now we execute this query
        mysql_query($myQuery);
    }
}
// ********************************************************** '
Esempio n. 9
0
session_start();
include_once "../../main_Lib.php";
header('Content-type: text/xml charset=iso-8859-1');
require "nitobi.xml.php";
$asignatura = $_GET['ramo'];
/*   This file is used as a Save Handler for the Grid control. When the user clicks
	 the save button in default.php a datagram is sent to this script.
	 The script in turn looks at each update in the datagram and processes them accordingly.

	 We have provided all the necessary functionality to extract any of the update instructions.

     This block of code is ADO connection code used only for demonstration purposes
     objConn is an ADO object we use here for demonstration purposes.
 */
$saveHandler = new EBASaveHandler();
$saveHandler->ProcessRecords();
// Make a MySQL Connection
$dbh = mysql_connect(BD_HOST, BD_USUARIO, BD_CLAVE) or die(mysql_error());
mysql_select_db($_SESSION['base_datos']->nombrebd) or die(mysql_error());
// ********************************************************** '
// Begin by processing our inserts
// ********************************************************** '
$insertCount = $saveHandler->ReturnInsertCount();
if ($insertCount > 0) {
    // Yes there are INSERTs to perform...
    for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
        $myQuery = "INSERT INTO alumnos (rut, matricula) VALUES (" . "'" . $saveHandler->ReturnInsertField($currentRecord, "rut") . "', " . "'" . $saveHandler->ReturnInsertField($currentRecord, "matricula") . "' " . "); ";
        // Now we execute this query
        mysql_query($myQuery);
    }
Esempio n. 10
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();
 }
Esempio n. 11
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();
 }
Esempio n. 12
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;