/** * @test * @codeCoverageIgnore */ public function createPreauthorization() { $this->_model->setToken("098f6bcd4621d373cade4e832627b4f6")->setAmount(100)->setCurrency('EUR'); $result = $this->_service->create($this->_model); $this->assertInstanceOf('Paymill\\Models\\Response\\Preauthorization', $result); $this->assertNotNull($result . getTransaction()); return $result; }
function print_subsidiary_ledger() { global $path_to_root, $systypes_array; $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $cat = $_POST['PARAM_2']; $account = $_POST['PARAM_3']; $account2 = $_POST['PARAM_4']; if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report2.inc"; } $orientation = $orientation ? 'L' : 'P'; $rep = new FrontReport(_('Subsidiary Ledger Report'), "SubsidiaryLedger", user_pagesize(), 9, L); $dec = user_price_dec(); //$headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2", // _('Person/Item'), _('Debit'), _('Credit'), _('Balance')); //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570); $cols = array(0, 50, 140, 200, 210, 400, 450, 550, 600, 650); //------------0--1---2-----3----4----5----6----7----8----9----10------- //-----------------------dim1-dim2----------------------------------- //-----------------------dim1---------------------------------------- //------------------------------------------------------------------- $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'right', 'right'); //$headers = array(_('ID'), '', '', '', '', '', '', _('Debit'), _('Credit'), _('Balance')); $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $fromacc)); if ($orientation == 'L') { recalculate_cols($cols); } $rep->SetHeaderType('header3'); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); if ($cat == 3) { $person = get_salesman_name($account); } if ($cat == 1) { $person = get_supplier_name($account); } /*$rep->TextCol(0,2, $cat); $rep->NewLine();*/ $rep->Font('bold'); $rep->TextCol(0, 2, "Name:" . $person); $rep->NewLine(); $rep->TextCol(0, 1, "ID:"); $rep->TextCol(1, 2, "Src:"); $rep->TextCol(2, 3, "Date:"); $rep->TextCol(4, 5, "Memo:"); $rep->TextCol(5, 6, "Account:"); $rep->TextCol(6, 7, "Debit:"); $rep->TextCol(8, 9, "Credit:"); $rep->Font(); $rep->NewLine(2); $result = getTransaction($from, $to, $cat, $account, $account2); $type = ''; while ($myrow = db_fetch($result)) { if ($myrow['Voided'] == '' && $myrow['amount'] > 0) { $comments = get_comments_string($myrow['type'], $myrow['type_no']); $custom = get_custom_no($myrow['type_no'], $myrow['type']); if ($myrow['type'] == ST_DISBURSEMENT) { $type = "CD"; } if ($myrow['type'] == ST_PURCHASEORDER) { $type = "P.O."; } if ($myrow['type'] == ST_SUPPAYMENT) { $type = "CD"; } //else // $type = $systypes_array[$myrow["type"]]; $rep->TextCol(0, 1, "#" . $custom); $rep->TextCol(1, 2, $type); $rep->TextCol(2, 3, $myrow['tranDate']); $rep->TextCol(4, 5, $comments); $rep->TextCol(5, 6, $myrow['account']); $dr += $myrow['amount']; $rep->AmountCol(6, 7, $myrow['amount'], 2); $rep->NewLine(); } else { if ($myrow['Voided'] == '' && $myrow['amount'] < 0) { $cr += $myrow['amount']; //$rep->AmountCol(8,9, $myrow['amount'], 2); } } } $rep->NewLine(2); $rep->Font('bold'); $rep->AmountCol(6, 7, $dr, 2); $rep->NewLine(2); $rep->TextCol(1, 2, "Net Activity: "); $rep->AmountCol(2, 4, $cr, 2); $rep->End(); }
function print_subsidiary_ledger() { global $path_to_root, $systypes_array; $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $cat = $_POST['PARAM_2']; $account = $_POST['PARAM_3']; if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report2.inc"; } $orientation = $orientation ? 'L' : 'P'; $rep = new FrontReport(_('Subsidiary Ledger Report'), "SubsidiaryLedger", user_pagesize(), 9, $orientation); $dec = user_price_dec(); //$headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2", // _('Person/Item'), _('Debit'), _('Credit'), _('Balance')); //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570); $cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525); //------------0--1---2---3----4----5----6----7----8----9----10------- //-----------------------dim1-dim2----------------------------------- //-----------------------dim1---------------------------------------- //------------------------------------------------------------------- $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right'); $headers = array(_('ID'), '', '', '', '', '', '', _('Debit'), _('Credit'), _('Balance')); $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $fromacc)); if ($orientation == 'L') { recalculate_cols($cols); } $rep->SetHeaderType('0'); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); $rep->NewLine(5); $rep->TextCol(4, 8, "ST. MATTHEWS PUBLISHING CORPORATION"); $rep->NewLine(); $rep->TextCol(1, 10, "First RVC Building #92 Anonas corner K-6 Streets, East Kamias, Quezon City 1102"); $rep->NewLine(3); $rep->TextCol(4, 8, "SUBSIDIARY LEDGER"); $rep->NewLine(2); //date range here if ($cat == 3) { $person = get_salesman_name($account); } $rep->TextCol(0, 2, "Name:" . $person); $rep->NewLine(); $rep->TextCol(0, 1, "ID:"); $rep->TextCol(1, 2, "Src:"); $rep->TextCol(2, 3, "Date:"); $rep->TextCol(3, 4, "Memo:"); $rep->TextCol(4, 5, "Account:"); $rep->TextCol(5, 6, "Debit:"); $rep->TextCol(6, 7, "Credit:"); $rep->NewLine(2); /* $rep->TextCol(0,1, $from); $rep->TextCol(1,2, $to); $rep->TextCol(2,3, $cat); $rep->TextCol(3,4, $account);*/ $rep->TextCol(0, 1, $person); $rep->NewLine(); $result = getTransaction($from, $to, $cat, $account); while ($myrow = db_fetch($result)) { if ($myrow['type'] == ST_DISBURSEMENT && $myrow['customized_no'] != 0) { $type = "CV"; } else { $type = ""; } $rep->TextCol(0, 5, $type . "#" . $myrow['customized_no']); $rep->TextCol(2, 3, ""); $rep->TextCol(3, 4, $myrow['tran_date']); $rep->TextCol(4, 5, $myrow['account']); $rep->AmountCol(5, 6, $myrow['amount'], 2); if ($myrow['amount'] < 0) { $cr += $myrow['amount']; } if ($myrow['amount'] > 0) { $dr += $myrow['amount']; } $rep->NewLine(); } $rep->AmountCol(5, 6, $dr, 2); $rep->NewLine(); $rep->AmountCol(1, 2, abs($cr), 2); $rep->End(); }
} } echo ']}'; } else { echo '{"result":0,"message":"No transactions found"}'; } } switch ($cmd) { case 1: transact(); break; case 2: delete(); break; case 3: getTransaction(); break; case 4: getByTime(); break; case 5: getByEmp(); break; case 6: transactions(); break; case 7: checkDiscount(); default: break; }
<?php include 'db_helper.php'; if ($_GET['f'] == 'add' && $_GET['sid'] && $_GET['tid'] && $_GET['class'] && $_GET['duration']) { addTransaction($_GET['sid'], $_GET['tid'], $_GET['class'], $_GET['duration']); } elseif ($_GET['f'] == 'get' && $_GET['p1']) { getTransaction($_GET['p1']); } elseif ($_GET['f'] == 'upd' && $_GET['p1'] && $_GET['p2'] && $_GET['p3'] && $_GET['p4']) { updateTransaction($_GET['p1'], $_GET['p2'], $_GET['p3'], $_GET['p4']); } elseif ($_GET['f'] == 'list' && $_GET['sid'] && $_GET['con']) { listTransaction($_GET['sid'], $_GET['con']); } elseif ($_GET['f'] == 'list' && $_GET['tid'] && $_GET['con']) { listTransactionWithTutorID($_GET['tid'], $_GET['con']); } elseif ($_GET['f'] == 'con' && $_GET['tid'] && $_GET['sid'] && $_GET['rate'] && $_GET['class']) { confirmTrasaction($_GET['tid'], $_GET['sid'], $_GET['rate'], $_GET['class']); } function confirmTrasaction($tid, $sid, $rate, $class) { $dbQuery = sprintf("UPDATE Transaction SET rate='%d', Confirmed = '%d' WHERE S_ID = '%d'AND T_ID = '%d' AND Class = '%d'", $rate, 1, $sid, $tid, $class); $result = getDBResultAffected($dbQuery); //header("Content-type: application/json"); echo json_encode($result); } function getTransaction($email) { $dbQuery = sprintf("SELECT name FROM Transaction WHERE email = '%s'", mysql_real_escape_string($email)); // $result = getDBResultRecord($dbQuery); //header("Content-type: application/json"); echo json_encode($result); }
function rest_put($req) { global $routes; global $JSON; include '../../includes/database.php'; $table = $req[0]; if (checkPrivileges($table) == false || checkTableReqs($table, $JSON) == false) { rest_error("Insufficient Priveleges OR incorrect JSON Requirements", 401); return; } $ret = reqRouter($req, "PUT"); if ($ret == 0) { rest_error("Item Exists Or Incorrect JSON Properties.", 409); return; } else { if ($ret == 2) { if (!isset($JSON["OrderSymbols"])) { rest_error("NO Order received, check JSON", 406); } $list = $JSON["OrderSymbols"]; $orders = explode(" , ", $list); $arr = []; $allPossibles = sql_GET_JOIN(["tables" => ["symbols"], "from" => "ingredients", "relations" => [["symbols.Name", "ingredients.Symbol"]], "select" => ["symbols.Symbol"]]); for ($i = 0; $i < count($orders); $i++) { $ingredients = explode(" ", $orders[$i]); //from here we need to check that each ingrediant is valid and available? for ($x = 0; $x < count($ingredients); $x++) { $ingrediant = $ingredients[$x]; $num = isInside($allPossibles, "Symbol", $ingrediant); if ($num == -1) { rest_error($ingrediant . " is not a valid ingredient!", 406); return; } $cur = $allPossibles[$num]; } } $table = "orders"; $JSON["TransactionID"] = getTransaction(); } } if ($req[0] == "users") { if (!filter_var($JSON["Email"], FILTER_VALIDATE_EMAIL)) { rest_error("Invalid Email, Please Enter a Valid Email address.", 406); return; } } $stmt = $db->prepare(sql_PUT($table)); $ex = buildJSONInputWProps($table, $JSON); if (is_string($ex)) { rest_error("Property: '" . $ex . "' is not set on provided JSON Object. Your JSON May be Mal-Formed,incorrect for the database or some other error may have occured", 400); return; } $var = $stmt->execute($ex); if ($var) { rest_success('Inputted Successfully Into the DataBase!'); } else { rest_error('Input unsuccessful. Check spelling this is usually thrown when an item should match another tables item.', 406); } /* $stmt = $db->prepare(sql_PUT($req)); $stmt->execute(array(':fname' => $fname, ':lname' => $lname,':email' => $email,':pass' => $password,':verified'=>0));*/ return 0; }