Skip to content

Commit

Permalink
Correct invalid function name and clean up code
Browse files Browse the repository at this point in the history
Files Changed:
api/api_debtortransactions.ph
api/api_stock.php
api/api_workorders.php
Correct function call from GetNextTransactionNo() to GetNextTransNo()
Change variable names to conform to coding standards
Change code layout to conform to coding standards
Fixes issue no #24 see - timschofield#24
  • Loading branch information
timschofield committed Mar 29, 2018
1 parent 7f2499d commit cec3387
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions api/api_debtortransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ function InsertSalesInvoice($InvoiceDetails, $user, $password) {
unset($InvoiceDetails['partcode']);
$SalesArea=$InvoiceDetails['salesarea'];
unset($InvoiceDetails['salesarea']);
$InvoiceDetails['transno']=GetNextTransactionNo(10);
$InvoiceDetails['transno']=GetNextTransNo(10);
$InvoiceDetails['type'] = 10;
$Errors=VerifyDebtorExists($InvoiceDetails['debtorno'], sizeof($Errors), $Errors);
$Errors=VerifyBranchNoExists($InvoiceDetails['debtorno'],$InvoiceDetails['branchcode'], sizeof($Errors), $Errors);
Expand Down Expand Up @@ -1256,13 +1256,13 @@ function InsertSalesInvoice($InvoiceDetails, $user, $password) {
$sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames,0,-2) .")
VALUES ('" . mb_substr($FieldValues,0,-2) ."') ";
$result = DB_query($sql);
$sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(10) . "' WHERE typeid=10";
$sql = "UPDATE systypes SET typeno='" . GetNextTransNo(10) . "' WHERE typeid=10";
$result = DB_query($sql);
$SalesGLCode=GetSalesGLCode($SalesArea, $PartCode);
$DebtorsGLCode=GetDebtorsGLCode($db);
$sql="INSERT INTO gltrans VALUES(null,
10,
'" . GetNextTransactionNo(10) . "',
'" . GetNextTransNo(10) . "',
0,
'" . $InvoiceDetails['trandate'] ."',
'" . $InvoiceDetails['prd'] . "',
Expand All @@ -1275,7 +1275,7 @@ function InsertSalesInvoice($InvoiceDetails, $user, $password) {
$result = api_DB_query($sql);
$sql="INSERT INTO gltrans VALUES(null,
10,
'" . GetNextTransactionNo(10) . "',
'" . GetNextTransNo(10) . "',
0,
'" . $InvoiceDetails['trandate'] ."',
'" . $InvoiceDetails['prd'] . "',
Expand Down Expand Up @@ -1490,7 +1490,7 @@ function InsertSalesCredit($CreditDetails, $user, $password) {
unset($CreditDetails['partcode']);
$SalesArea=$CreditDetails['salesarea'];
unset($CreditDetails['salesarea']);
$CreditDetails['transno']=GetNextTransactionNo(11);
$CreditDetails['transno']=GetNextTransNo(11);
$CreditDetails['type'] = 10;
$Errors=VerifyDebtorExists($CreditDetails['debtorno'], sizeof($Errors), $Errors);
$Errors=VerifyBranchNoExists($CreditDetails['debtorno'],$CreditDetails['branchcode'], sizeof($Errors), $Errors);
Expand Down Expand Up @@ -1554,13 +1554,13 @@ function InsertSalesCredit($CreditDetails, $user, $password) {
$sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames,0,-2) . ")
VALUES ('".mb_substr($FieldValues,0,-2) ."') ";
$result = DB_query($sql);
$sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(11) ."' WHERE typeid=10";
$sql = "UPDATE systypes SET typeno='" . GetNextTransNo(11) ."' WHERE typeid=10";
$result = DB_query($sql);
$SalesGLCode=GetSalesGLCode($SalesArea, $PartCode);
$DebtorsGLCode=GetDebtorsGLCode($db);
$sql="INSERT INTO gltrans VALUES(null,
10,
'" . GetNextTransactionNo(11). "',
'" . GetNextTransNo(11). "',
0,
'" . $CreditDetails['trandate'] . "',
'" . $CreditDetails['prd'] . "',
Expand All @@ -1572,7 +1572,7 @@ function InsertSalesCredit($CreditDetails, $user, $password) {
$result = DB_query($sql);
$sql="INSERT INTO gltrans VALUES(null,
10,
'" . GetNextTransactionNo(11) . "',
'" . GetNextTransNo(11) . "',
0,
'" . $CreditDetails['trandate'] ."',
'" . $CreditDetails['prd'] . "',
Expand Down
8 changes: 4 additions & 4 deletions api/api_stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ function StockAdjustment($StockID, $Location, $Quantity, $TranDate, $user, $pass
newqoh)
VALUES ('" . $StockID . "',
'17',
'" .GetNextTransactionNo(17)."',
'" .GetNextTransNo(17)."',
'".$Location."',
'".$TranDate."',
'".GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors)."',
Expand All @@ -824,7 +824,7 @@ function StockAdjustment($StockID, $Location, $Quantity, $TranDate, $user, $pass
amount,
narrative)
VALUES ('17',
'" . GetNextTransactionNo(17)."',
'" . GetNextTransNo(17)."',
'" . $TranDate. "',
'".GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors). "',
'" .$adjglact."',
Expand All @@ -838,13 +838,13 @@ function StockAdjustment($StockID, $Location, $Quantity, $TranDate, $user, $pass
amount,
narrative)
VALUES ('17',
'" .GetNextTransactionNo(17)."',
'" .GetNextTransNo(17)."',
'" .$TranDate."',
'" .GetPeriodFromTransactionDate($TranDate, sizeof($Errors), $Errors). "',
'" .$stockact."',
'" .$itemdetails['materialcost']*$Quantity. "',
'" .$StockID.' x '.$Quantity.' @ '.$itemdetails['materialcost']."')";
$systypessql = "UPDATE systypes set typeno='".GetNextTransactionNo(17)."' where typeid='17'";
$systypessql = "UPDATE systypes set typeno='".GetNextTransNo(17)."' where typeid='17'";

DB_Txn_Begin();
DB_query($stockmovesql);
Expand Down
8 changes: 4 additions & 4 deletions api/api_workorders.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function InsertWorkOrder($WorkOrderDetails, $user, $password) {
foreach ($WorkOrderDetails as $key => $value) {
$WorkOrderDetails[$key] = DB_escape_string($value);
}
$WorkOrder['wo']=GetNextTransactionNo(40);
$WorkOrder['wo']=GetNextTransNo(40);
$WorkOrderItem['wo']=$WorkOrder['wo'];
if (isset($WorkOrderDetails['loccode'])){
$Errors=VerifyFromStockLocation($WorkOrderDetails['loccode'], sizeof($Errors), $Errors);
Expand Down Expand Up @@ -241,7 +241,7 @@ function InsertWorkOrder($WorkOrderDetails, $user, $password) {
'VALUES ('.mb_substr($WOFieldValues,0,-2).') ';
$itemsql = 'INSERT INTO woitems ('.mb_substr($ItemFieldNames,0,-2).') '.
'VALUES ('.mb_substr($ItemFieldValues,0,-2).') ';
$systypessql = 'UPDATE systypes set typeno='.GetNextTransactionNo(40).' where typeid=40';
$systypessql = 'UPDATE systypes set typeno='.GetNextTransNo(40).' where typeid=40';
DB_Txn_Begin();
$woresult = DB_query($wosql);
$itemresult = DB_query($itemsql);
Expand Down Expand Up @@ -285,7 +285,7 @@ function WorkOrderIssue($WONumber, $StockID, $Location, $Quantity, $TranDate, $B
$wipglact=GetCategoryGLCode($itemdetails[1]['categoryid'], 'wipact');
$stockact=GetCategoryGLCode($itemdetails[1]['categoryid'], 'stockact');
$cost=$itemdetails[1]['materialcost']+$itemdetails[1]['labourcost']+$itemdetails[1]['overheadcost'];
$TransactionNo=GetNextTransactionNo(28);
$TransactionNo=GetNextTransNo(28);

$stockmovesql="INSERT INTO stockmoves (stockid,
type,
Expand Down Expand Up @@ -394,7 +394,7 @@ function WorkOrderReceive($WONumber, $StockID, $Location, $Quantity, $TranDate,
$costresult=DB_query($costsql);
$myrow=DB_fetch_row($costresult);
$cost=$myrow[0];
$TransactionNo=GetNextTransactionNo(26);
$TransactionNo=GetNextTransNo(26);
$stockmovesql="INSERT INTO stockmoves (stockid,
type,
transno,
Expand Down

0 comments on commit cec3387

Please sign in to comment.