示例#1
0
<?php

include "system.php";
include_once '../simbiz/class/PaymentVoucher.php';
include_once '../simbiz/class/PaymentVoucherLine.php';
include_once "../simantz/class/datepicker/class.datepicker.php";
include_once '../simantz/class/Currency.inc.php';
$cur = new Currency();
//include_once "../system/class/Period.php";
$dp = new datepicker($url);
$dp->dateFormat = 'Y-m-d';
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$o = new PaymentVoucher();
$pl = new PaymentVoucherLine();
$s = new XoopsSecurity();
$orgctrl = "";
$action = "";
$o->paymentvoucher_id = 0;
if (isset($_POST['action'])) {
    $action = $_POST['action'];
    $o->paymentvoucher_id = $_POST["paymentvoucher_id"];
} elseif (isset($_GET['action'])) {
    $action = $_GET['action'];
    $o->paymentvoucher_id = $_GET["paymentvoucher_id"];
} else {
    $action = "";
}
$token = $_POST['token'];
//$o->paidto=$_POST["paidto"];
$iscomplete = $_POST['iscomplete'];
$o->organization_id = $_POST['organization_id'];
示例#2
0
 public static function GetSupplierTransactions($sid, $category, $dates, $all)
 {
     if ($category == 1) {
         //Statement
         if ($all == 'true') {
             $sql = 'SELECT * FROM general_ledger_entries WHERE account_no = ' . intval($sid) . ' AND ledger_name = "Creditors" ORDER BY id DESC';
         } else {
             if ($dates != '') {
                 $split = explode(' - ', $dates);
                 $d1 = explode('/', $split[0]);
                 $d2 = explode('/', $split[1]);
                 $lower = $d1[2] . $d1[0] . $d1[1] . '000000' + 0;
                 $upper = $d2[2] . $d2[0] . $d2[1] . '999999' + 0;
                 $sql = 'SELECT * FROM general_ledger_entries WHERE account_no = ' . intval($sid) . ' AND ledger_name = "Creditors" AND stamp BETWEEN ' . $lower . ' AND ' . $upper . ' ORDER BY id DESC';
             }
         }
         try {
             $res = DatabaseHandler::GetAll($sql);
             $vouchers = [];
             foreach ($res as $tx) {
                 if ($tx['status'] == 1) {
                     if ($tx['effect'] == 'dr') {
                         $voucher = PaymentVoucher::GetVoucher(intval($tx['transaction_id']));
                         if ($voucher) {
                             $vouchers[] = $voucher;
                         }
                     } else {
                         $voucher = PurchaseVoucher::GetVoucher(intval($tx['transaction_id']));
                         if ($voucher) {
                             $vouchers[] = $voucher;
                         }
                     }
                 } elseif ($tx['status'] == 3) {
                     $entry = new stdClass();
                     $entry->transactionId = $tx['transaction_id'];
                     $entry->date = $tx['when_charged'];
                     $entry->amount = $tx['amount'];
                     $entry->description = $tx['description'];
                     $sql2 = 'SELECT * FROM transactions WHERE id = ' . intval($tx['transaction_id']);
                     $res2 = DatabaseHandler::GetRow($sql2);
                     $entry->user = $res2['user'];
                     $entry->type = $res2['type'];
                     $vouchers[] = $entry;
                 }
             }
             return $vouchers;
         } catch (Exception $e) {
         }
     } else {
         //orders
         if ($all == 'true') {
             $sql = 'SELECT * FROM purchase_orders WHERE supplier_id = ' . intval($sid) . ' ORDER BY id DESC';
         } else {
             $split = explode(' - ', $dates);
             $d1 = explode('/', $split[0]);
             $d2 = explode('/', $split[1]);
             $lower = $d1[2] . $d1[0] . $d1[1] . '000000' + 0;
             $upper = $d2[2] . $d2[0] . $d2[1] . '999999' + 0;
             $sql = 'SELECT * FROM purchase_orders WHERE supplier_id = ' . intval($sid) . ' AND stamp BETWEEN ' . $lower . ' AND ' . $upper . ' ORDER BY id DESC';
         }
         try {
             $res = DatabaseHandler::GetAll($sql);
             $vouchers = [];
             foreach ($res as $order) {
                 $vouchers[] = PurchaseOrderVoucher::initialize($order);
             }
             return $vouchers;
         } catch (Exception $e) {
         }
     }
 }