本文整理汇总了PHP中Batch::getLatestBatchID方法的典型用法代码示例。如果您正苦于以下问题:PHP Batch::getLatestBatchID方法的具体用法?PHP Batch::getLatestBatchID怎么用?PHP Batch::getLatestBatchID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Batch
的用法示例。
在下文中一共展示了Batch::getLatestBatchID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if ($trans->defaultline == "") {
$trans->defaultline = 0;
}
if ($reuse == 1 or $reuse == "on") {
$o->reuse = 1;
} else {
$o->reuse = 0;
}
switch ($action) {
//When user submit new organization
case "create":
// if the token is exist and not yet expired
$log->showLog(4, "Accessing create record event, with batch name={$o->batch_name}");
//if ($s->check(true,$token,"CREATE_ACG")){
if ($o->insertBatch()) {
$latest_id = $o->getLatestBatchID();
$defaultdebit = $_POST["defaultdebit"];
$defaultcredit = $_POST["defaultcredit"];
$defaultdocno1 = $_POST["defaultdocno1"];
$refdocno1 = $_POST["refdocno1"];
$defaultchequeno = $_POST["defaultchequeno"];
$refchequeno = $_POST["refchequeno"];
$linedescdef = $_POST["linedescdef"];
$linedescref = $_POST["linedescref"];
$defaultamt = 0;
if ($trans->defaultaccountsref_id > 0) {
if ($trans->refamtvaluecredit > 0) {
$defaultamt = $defaultdebit;
} else {
$defaultamt = $defaultcredit * -1;
}
示例2: PostBatch
public function PostBatch($uid, $date, $systemname, $batch_name, $description, $totaltransactionamt, $documentnoarray, $accountsarray, $amtarray, $currencyarray, $conversionarray, $originalamtarray, $bpartnerarray, $transtypearray, $linetypearray, $chequenoarray, $linedesc = "", $isreadonly = 0, $batchno = "", $orgarray, $track1array, $track2array, $track3array)
{
include_once "../simbiz/class/Batch.php";
include_once "../simbiz/class/Accounts.php";
include_once "../simbiz/class/Transaction.php";
include_once "../simbiz/class/FinancialYearLine.php";
include_once "../simantz/class/Period.inc.php";
// include_once "system.php";
global $xoopsDB, $log, $defaultorganization_id, $tableprefix;
$tablebatch = $tableprefix . "simbiz_batch";
$tabletransaction = $tableprefix . "simbiz_transaction";
$batch = new Batch();
$acc = new Accounts();
$trans = new Transaction();
$fyl = new FinancialYearLine();
$period = new Period();
$year = $this->left($date, 4);
$month = $this->right($this->left($date, 7), 2);
$period_id = $period->getPeriodID($year, $month);
$allowtrans = $fyl->allowAccountTransactionInDate($defaultorganization_id, $date);
if (!$allowtrans) {
$log->showLog(1, "Can't post data due to period in financial year is closed. You can fix this problem on re-opened this period at Financial Year window(under simbiz module)");
return false;
}
$totaltransactionamt = abs($totaltransactionamt);
//1.get next batch no
if ($batchno == "") {
$batchno = getNewCode($xoopsDB, "batchno", $tablebatch);
}
$timestamp = date("y/m/d H:i:s", time());
//2. Create new batch
$sqlinsertbatch = "INSERT INTO {$tablebatch} (organization_id, batchno,batch_name,description,created,createdby,\r\n\t\t\tupdated,updatedby,totaldebit,totalcredit,fromsys,batchdate,iscomplete,isreadonly,period_id) values(\r\n\t\t\t{$defaultorganization_id}, '{$batchno}','{$batch_name}','{$description}','{$timestamp}',{$uid},\r\n\t\t\t'{$timestamp}',{$uid},{$totaltransactionamt},{$totaltransactionamt},'{$systemname}','{$date}',1,{$isreadonly},{$period_id})";
$rsinsertbatch = $xoopsDB->query($sqlinsertbatch);
if (!$rsinsertbatch) {
$log->showLog(1, __LINE__ . "PostBatch Create batch failed with sqlinsertbatch: {$sqlinsertbatch} ");
return false;
} else {
$log->showLog(4, "Create batch successfully with sqlinsertbatch: {$sqlinsertbatch} ");
$newbatch_id = $batch->getLatestBatchID();
$i = 0;
$reference_id = 0;
foreach ($accountsarray as $accounts_id) {
//3. Loop to create transaction
if ($i != 0 && ($i == 1 || $linetypearray[$i - 1] == 0)) {
$reference_id = $this->latestTransactionId();
} elseif ($linetypearray[$i] == 0 && $i > 0) {
$reference_id = 0;
}
if ($orgarray[$i] == "") {
$orgarray[$i] == $defaultorganization_id;
}
if ($track1array[$i] == "") {
$track1array[$i] = 0;
}
if ($track2array[$i] == "") {
$track2array[$i] = 0;
}
if ($track3array[$i] == "") {
$track3array[$i] = 0;
}
$sqlinserttransaction = "INSERT INTO {$tabletransaction} (\r\n\t\t\t\t\tdocument_no,batch_id,amt,currency_id,originalamt,\r\n\t\t\t\t\ttranstype,accounts_id,multiplyconversion,\r\n\t\t\t\t\tseqno,reference_id,bpartner_id,document_no2,linedesc,branch_id,track_id1,track_id2,track_id3)\r\n\t\t\t\t\tVALUES (\r\n\t\t\t\t\t'{$documentnoarray[$i]}',{$newbatch_id},{$amtarray[$i]},{$currencyarray[$i]},{$originalamtarray[$i]},\r\n\t\t\t\t\t'{$transtypearray[$i]}',{$accounts_id},{$conversionarray[$i]},'{$i}',{$reference_id},{$bpartnerarray[$i]},\r\n\t\t\t\t\t'{$chequenoarray[$i]}','{$linedesc[$i]}', {$orgarray[$i]},{$track1array[$i]},{$track2array[$i]},{$track3array[$i]})";
$rsinserttransaction = $xoopsDB->query($sqlinserttransaction);
if (!$rsinserttransaction) {
echo mysql_error();
$log->showLog(1, __LINE__ . "PostBatch Create transaction line failed with\r\n\t\t\t\t\t\t\t sqlinserttransaction: {$sqlinserttransaction},<br>deleteing batch: {$newbatch_id}");
$batch->deleteBatch($newbatch_id);
return false;
} else {
$log->showLog(4, __LINE__ . "PostBatch Create transaction line successfully with\r\n\t\t\t\t\t\t\t sqlinserttransaction: {$sqlinserttransaction} ");
}
$i++;
}
//4. update lastbalance for accounts, and parent accounts
$trans->compileSummary($newbatch_id);
//5. Update transaction summary
//6. update last balance for bpartner
$trans->insertTransactionSummary($newbatch_id, $defaultorganization_id, 1);
//7. put batch id, batch no at resultbatch_id,$resultbatch_no
$this->resultbatch_id = $newbatch_id;
$this->resultbatch_no = $batchno;
//return true or false
//$acc->repairAccounts();
return true;
}
return false;
}