Exemple #1
0
 public function searchResults($search)
 {
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $_SESSION['accountID'] = $search['accountID'];
     $this->setAccountSelected($_SESSION['accountID']);
     $account = new Account();
     $account->accountID = $_SESSION['accountID'];
     $account->getAccount();
     $_SESSION['searchDetails'] = $search['searchDetails'];
     $_SESSION['fromAmount'] = $search['fromAmount'];
     $_SESSION['toAmount'] = $search['toAmount'];
     if (strlen($search['toDate']) != 0) {
         $_SESSION['toDate'] = $search['toDate'];
     } else {
         $_SESSION['toDate'] = date('Y-m-d');
     }
     if (strlen($search['fromDate']) != 0) {
         $_SESSION['fromDate'] = $search['fromDate'];
     } else {
         $_SESSION['fromDate'] = date("Y-m-d", strtotime("-1 months"));
     }
     $_SESSION['period'] = date('d/m/Y', strtotime($_SESSION['fromDate'])) . ' to ' . date('d/m/Y', strtotime($_SESSION['toDate']));
     $transactions = new Transactions();
     $transactions->accountID = $_SESSION['accountID'];
     $arr = array('openBalance' => $account->openBalance);
     $_SESSION['history'] = $transactions->getTransactions($arr);
     $_SESSION['found'] = $transactions->countTransactions($arr);
     $_SESSION['historyDebit'] = $transactions->getDebits($arr);
     $_SESSION['historyCredit'] = $transactions->getCredits($arr);
     $_SESSION['historyFee'] = $transactions->getFees($arr);
     $_SESSION['historyNet'] = $transactions->getNet($arr);
 }
Exemple #2
0
 private function reach($type, $yaer)
 {
     $cheques = new Transactions('search');
     $cheques->unsetAttributes();
     $sums = array();
     for ($x = 1; $x <= 12; $x++) {
         if ($x <= 9) {
             $a = "0{$x}";
         } else {
             $a = $x;
         }
         $last = 31;
         while (!checkdate($x, $last, date("Y"))) {
             $last--;
         }
         $result = $this->sum($cheques, $type, $yaer . "-{$a}-01" . " 00:00:00", $yaer . "-{$a}-{$last}" . " 23:59:59");
         if ($result == 0) {
             array_push($sums, "0");
         } else {
             if ($type == 2) {
                 $result = $result * -1;
             }
             array_push($sums, round($result));
         }
     }
     return $sums;
 }
 public function search($id)
 {
     //echo $id . uniqid();
     $transactions = new Transactions('search');
     $transactions->unsetAttributes();
     $transactions->account_id = $id;
     $transactions->from_date = $this->from_date;
     $transactions->to_date = $this->to_date;
     return $transactions->search();
 }
 public function actionTransaction($id = 200)
 {
     $model = new Transactions('search');
     $model->unsetAttributes();
     if (isset($_POST['Transactions'])) {
         $model->attributes = $_POST['Transactions'];
     }
     $model->account_id = $id;
     $this->render('transaction', array('model' => $model, 'account' => $this->loadModel($id)));
 }
 public function actionIndex($user_id = NULL)
 {
     Yii::import('application.modules.deposit.extensions.Deposit.Deposit');
     $model = new Transactions('search');
     $model->unsetAttributes();
     if (isset($_GET['Transactions'])) {
         $model->setAttributes($_GET['Transactions']);
     }
     $dataProvider = $model->search();
     $this->render('//transactions/index', array('dataProvider' => $dataProvider, 'model' => $model, 'aggregatorsList' => Deposit::getAggregatorsList()));
 }
Exemple #6
0
 public function actionIntmatchajax()
 {
     $in = new Transactions('search');
     $out = new Transactions('search');
     $in->unsetAttributes();
     $out->unsetAttributes();
     if (isset($_POST['FormIntmatch'])) {
         $in->attributes = $_POST['FormIntmatch'];
         $out->attributes = $_POST['FormIntmatch'];
     }
     $this->renderPartial('intmatchajax', array('in' => $in, 'out' => $out));
 }
 /**
  * Просмотр транзакций юзера
  *
  * @param int $user_id
  */
 public function actionTransactionHistory($user_id)
 {
     Yii::import('application.modules.deposit.extensions.Deposit.Deposit');
     $model = new Transactions('search');
     $model->unsetAttributes();
     if (isset($_GET['Transactions'])) {
         $model->setAttributes($_GET['Transactions']);
     }
     $dataProvider = $model->search();
     $dataProvider->criteria->mergeWith(array('condition' => 't.user_id = :user_id', 'params' => array('user_id' => $user_id)));
     $this->render('//users/transaction-history', array('user' => Users::model()->findByPk($user_id), 'model' => $model, 'dataProvider' => $dataProvider, 'aggregatorsList' => Deposit::getAggregatorsList()));
 }
Exemple #8
0
 public function save()
 {
     //create Match
     $match = new ExtCorrelation();
     $match->account_id = $this->account_id;
     $match->owner = Yii::app()->user->id;
     $match->save();
     //bankbooks
     //print_r($this->Bankbooks);
     //print_r($this->Transactions);
     foreach ($this->Bankbooks['match'] as $bankbook => $true) {
         Yii::log("bank:" . $bankbook, 'info', 'app');
         $bankbook = Bankbook::model()->findByPk($bankbook);
         if ($bankbook !== null) {
             $bankbook->extCorrelation = $match->id;
             $bankbook->save();
         }
     }
     //transaction
     foreach ($this->Transactions['match'] as $transaction => $true) {
         Yii::log("trans:" . $transaction, 'info', 'app');
         $transaction = Transactions::model()->findByPk($transaction);
         if ($transaction !== null) {
             $transaction->extCorrelation = $match->id;
             $transaction->save();
         }
     }
     return $match->id;
 }
 public static function fromArray($data)
 {
     $settings = new RoleSettings();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($settings), $key)) {
             if (is_array($value)) {
                 if ($key == "transactions") {
                     $settings->{$key} = Transactions::fromArray($value);
                 }
                 if ($key == "reports") {
                     $settings->{$key} = Reports::fromArray($value);
                 }
                 if ($key == "help") {
                     $settings->{$key} = Help::fromArray($value);
                 }
                 if ($key == "mobileVTAccess") {
                     $settings->{$key} = MobileVTAcces::fromArray($value);
                 }
                 if ($key == "admin") {
                     $settings->{$key} = Admin::fromArray($value);
                 }
                 if ($key == "customer") {
                     $settings->{$key} = Customers::fromArray($value);
                 }
                 if ($key == "webPosAccess") {
                     $settings->{$key} = WebPosAccess::fromArray($value);
                 }
             } else {
                 $settings->{$key} = $value;
             }
         }
     }
     return $settings;
 }
Exemple #10
0
 public function save()
 {
     //create Match
     $match = new IntCorrelation();
     $match->account_id = $this->account_id;
     $match->owner = Yii::app()->user->id;
     $match->save();
     //bankbooks
     foreach ($this->in as $transaction => $true) {
         $transaction = Transactions::model()->findByPk($transaction);
         if ($transaction !== null) {
             $transaction->intCorrelation = $match->id;
             $transaction->intType = true;
             $transaction->save();
         }
     }
     //transaction
     foreach ($this->out as $transaction => $true) {
         $transaction = Transactions::model()->findByPk($transaction);
         if ($transaction !== null) {
             $transaction->intCorrelation = $match->id;
             $transaction->intType = false;
             $transaction->save();
         }
     }
     return $match->id;
 }
Exemple #11
0
 public function save()
 {
     //print_r($this->Deposit);
     $num = 0;
     $linenum = 1;
     $tranType = Settings::model()->findByPk('transactionType.chequedeposit')->value;
     if ($this->refnum == '' || $this->date == '' || !is_array($this->Deposit)) {
         return false;
     }
     $valuedate = date("Y-m-d H:m:s", CDateTimeParser::parse($this->date, Yii::app()->locale->getDateFormat('yiishort')));
     foreach ($this->Deposit as $line => $val) {
         list($a, $b) = explode(',', $line);
         $cheq = Doccheques::model()->findByPk(array("doc_id" => $a, "line" => $b));
         $oppt_acc = PaymentType::model()->findByPk($cheq->type)->oppt_account_id;
         //print_r($cheq);
         $accout = new Transactions();
         $accout->num = $num;
         $accout->account_id = $this->account_id;
         $accout->type = $tranType;
         $accout->refnum1 = $this->refnum;
         $accout->valuedate = $valuedate;
         //$accout->details=$this->company;
         $accout->currency_id = $cheq->currency_id;
         $accout->owner_id = Yii::app()->user->id;
         $accout->linenum = $linenum;
         $accout->sum = $cheq->sum * -1;
         $linenum++;
         $num = $accout->save();
         $oppt = new Transactions();
         $oppt->num = $num;
         $oppt->account_id = $oppt_acc;
         $oppt->type = $tranType;
         $oppt->refnum1 = $this->refnum;
         $oppt->valuedate = $valuedate;
         //$oppt->details=$this->company;
         $oppt->currency_id = $cheq->currency_id;
         $oppt->owner_id = Yii::app()->user->id;
         $oppt->linenum = $linenum;
         $oppt->sum = $cheq->sum * 1;
         $linenum++;
         $num = $oppt->save();
         $cheq->bank_refnum = $num;
         $cheq->save();
     }
     //Yii::app()->end();
     return $num;
 }
 public function actionIndex()
 {
     $dependency = new CDbCacheDependency('SELECT COUNT(0) FROM {{transactions}} WHERE user_id = :user_id');
     $dependency->params = array('user_id' => user()->getId());
     $model = Transactions::model()->cache(3600 * 24, $dependency, 2);
     $dataProvider = new CActiveDataProvider($model, array('criteria' => array('condition' => 'user_id = :user_id', 'params' => array('user_id' => user()->getId()), 'order' => 'created_at DESC'), 'pagination' => array('pageSize' => config('cabinet.transaction_history.limit'), 'pageVar' => 'page')));
     $this->render('//cabinet/transaction-history', array('dataProvider' => $dataProvider));
 }
 public function actionOpenBalance()
 {
     $model = new Transactions();
     if (isset($_POST['account'])) {
         $year = $_POST['year'];
         $date = "{$year}-01-01 00:00:01";
         $accountArr = $_POST['account'];
         $balanceArr = $_POST['bal'];
         foreach ($accountArr as $index => $account) {
             $sum = $balanceArr[$index];
             if ($account) {
                 $submodel = new Transactions();
                 $submodel->date = $date;
                 $submodel->details = Yii::t('app', "Opening Balance");
                 $submodel->type = Yii::app()->user->settings['transactionType.openBalance'];
                 $submodel->currency_id = Yii::app()->user->settings['company.cur'];
                 $submodel->account_id = $account;
                 $submodel->sum = $sum;
                 $submodel->owner_id = Yii::app()->user->id;
                 $submodel->linenum = 1;
                 $submodel->save();
                 //$submodel->num;
                 $submodel1 = new Transactions();
                 $submodel1->num = $submodel->num;
                 $submodel1->date = $date;
                 $submodel1->details = Yii::t('app', "Opening Balance");
                 $submodel1->type = Yii::app()->user->settings['transactionType.openBalance'];
                 $submodel1->currency_id = Yii::app()->user->settings['company.cur'];
                 $submodel1->account_id = Yii::app()->user->settings['company.acc.openbalance'];
                 $submodel1->sum = $sum * -1.0;
                 $submodel1->owner_id = Yii::app()->user->id;
                 $submodel1->linenum = 2;
                 $submodel1->save();
             }
         }
         Yii::app()->user->setFlash('success', Yii::t('app', 'Open Balance saved'));
         //$this->redirect(array('OpenBalance'));
     }
     $this->render('opbalance', array('model' => $model));
 }
 public function actionProcessed()
 {
     $transactionId = app()->session['transaction_id'];
     $model = Transactions::model()->findByPk($transactionId);
     // Транзакция не найдена
     if ($model === NULL) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Транзакция не найдена.'));
         $this->redirect(array('index'));
     }
     if ($model->isPaid()) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Транзакция уже обработана.'));
         $this->redirect(array('index'));
     }
     $deposit = new Deposit();
     $deposit->init($model->payment_system);
     $this->render('//cabinet/deposit/processed', array('model' => $model, 'fields' => $deposit->getFields($model), 'formAction' => $deposit->getFormAction(), 'deposit' => $deposit));
 }
Exemple #15
0
    public function action_index()
    {
        // Set the name of the template to use
        $this->xslt_stylesheet = 'payslip';
        if (!isset($_GET['employee_id']) || !isset($_GET['period']) || !preg_match('/^\\d{4}-\\d{1,2}$/', $_GET['period'])) {
            throw new Kohana_exception('Invalid parameters');
        }
        $employee = new Employee($_GET['employee_id']);
        xml::to_XML($employee->get(), $this->xml_content->appendChild($this->dom->createElement('employee')), NULL, 'id');
        $where = '
			employee_id = ' . intval($_GET['employee_id']) . ' AND
			(
				description = \'Social fees period ' . $_GET['period'] . '\' OR
				description = \'Income taxes period ' . $_GET['period'] . '\' OR
				(
					description = \'Salary payout\' AND
					MONTH(transfer_date) = ' . substr($_GET['period'], 5) . ' AND
					YEAR(transfer_date) = ' . substr($_GET['period'], 0, 4) . '
				)
			)';
        xml::to_XML(Transactions::get(NULL, 'accounting_date', $where), $this->xml_content->appendChild($this->dom->createElement('transactions')), 'transaction', 'id');
    }
Exemple #16
0
 private function calc($accounts = array(), $types = array())
 {
     $sum = 0;
     $yiidatetimesec = Yii::app()->locale->getDateFormat('yiidatetimesec');
     $phpdbdatetime = Yii::app()->locale->getDateFormat('phpdbdatetime');
     $from_date = date($phpdbdatetime, CDateTimeParser::parse($this->from_date, $yiidatetimesec));
     $to_date = date($phpdbdatetime, CDateTimeParser::parse($this->to_date, $yiidatetimesec));
     $criteria = new CDbCriteria();
     $criteria->condition = "date BETWEEN :from_date AND :to_date";
     $criteria->params = array(':from_date' => $from_date, ':to_date' => $to_date);
     $criteria->compare('type', $types);
     $criteria->compare('account_id', $accounts);
     $trans = Transactions::model()->findAll($criteria);
     $sum = 0;
     $data = array();
     foreach ($trans as $tran) {
         $sum = $tran->sum;
         if ($sum != 0) {
             $data[] = array('id' => $tran->id, 'name' => $tran->account_id, 'sum' => $sum, 'id6111' => $tran->id);
         }
     }
     return $data;
 }
Exemple #17
0
 public function import()
 {
     //add warehouse
     $array = $this->read();
     //companies
     $company = $this->parseLine($array['companies'][0]);
     $prefix = $company[1];
     //echo $prefix;
     $this->saveSetting('company.name', $company[0]);
     $this->saveSetting('company.vat.id', $company[3]);
     $this->saveSetting('company.address', $company[4]);
     $this->saveSetting('company.city', $company[5]);
     $this->saveSetting('company.zip', $company[6]);
     $this->saveSetting('company.phone', $company[7]);
     $this->saveSetting('company.fax', $company[8]);
     $this->saveSetting('company.website', $company[9]);
     $this->saveSetting('company.tax.rate', $company[10]);
     $this->saveSetting('company.tax.irs', $company[11]);
     //$this->saveSetting('account.100.srctax', $company[12]);
     $this->saveSetting('company.tax.vat', $company[13]);
     //exit;
     ///*
     if (isset($array['accounts'])) {
         $this->imprtAccounts($array['accounts'], $prefix);
     }
     if (isset($array['items'])) {
         $this->imprtItems($array['items'], $prefix);
     }
     if (isset($array['docs'])) {
         $this->imprtDocs($array['docs'], $prefix);
     }
     if (isset($array['cheques'])) {
         $this->imprtCheques($array['cheques'], $prefix);
     }
     if (isset($array['docdetails'])) {
         $this->imprtDocdetails($array['docdetails'], $prefix);
     }
     if (isset($array['transactions'])) {
         $this->imprtTransactions($array['transactions'], $prefix);
     }
     if (isset($array['bankbook'])) {
         $this->imprtBankbooks($array['bankbook'], $prefix);
     }
     if (isset($array['correlation'])) {
         $this->imprtCorrelations($array['correlation'], $prefix);
     }
     //*/
     //vat rate
     $acc = Accounts::model()->findByPk(100);
     $acc->src_tax = $company[12];
     $acc->save();
     $acc = Accounts::model()->findByPk(101);
     $acc->src_tax = $company[12];
     $acc->save();
     //add warehouse
     //add genral item
     //get transaction num
     $this->saveSetting('company.transaction', Transactions::getMax() + 1);
     //get docnums
     $types = Doctype::model()->findAll();
     foreach ($types as $type) {
         $type->last_docnum = Docs::getMax($type->id);
         $type->save();
     }
     //contacthist
     //contacts??
     //tranrep??
 }
 public function addAccountUpdate($hash_in)
 {
     $hash_out = Transactions::createAccountUpdate($hash_in);
     $choice_hash = array(XmlFields::returnArrayValue($hash_out, 'card'), XmlFields::returnArrayValue($hash_out, 'token'));
     $this->addTransaction($hash_out, $hash_in, 'accountUpdate', $choice_hash);
     $this->counts_and_amounts['accountUpdate']['count'] += 1;
 }
Exemple #19
0
 public function actionJournal()
 {
     $model = new Transactions('search');
     $model->unsetAttributes();
     $vl = 'transactions-grid';
     //echo Yii::app()->request->isAjaxRequest;
     //Yii::app()->end();
     if (isset($_POST['Transactions'])) {
         $model->attributes = $_POST['Transactions'];
     }
     if (Yii::app()->request->isAjaxRequest || isset($_POST['ajax']) && $_POST['ajax'] === $vl) {
         // Render partial file created in Step 1
         $this->renderPartial('journal', array('model' => $model));
         Yii::app()->end();
     }
     $this->render('journal', array('model' => $model));
 }
Exemple #20
0
 public function getPayments()
 {
     $payments = new Transactions();
     $payments->accountID = $_SESSION['accountID'];
     if (isset($_SESSION['billPaymentList'])) {
         $payments->transactionType = 'Biller';
     } elseif (isset($_SESSION['fundsTransferPaymentList'])) {
         $payments->transactionType = 'Payee';
     } elseif (isset($_SESSION['allPaymentList'])) {
         $payments->transactionType = 'Both';
     }
     $_SESSION['payeeTransactions'] = $payments->getPayments();
     $_SESSION['numPayments'] = $payments->countPayments();
 }
 public function balanceInquiry($hash_in)
 {
     $hash_out = Transactions::createBalanceInquiryHash($hash_in);
     $txnResponse = $this->processRequest($hash_out, $hash_in, "balanceInquiry");
     return $txnResponse;
 }
Exemple #22
0
<?php

header("Content-type: text/xml; charset=utf-8");
include "TbcPayTerminal.php";
$TbcPay = new TbcPayTerminal();
$TbcPay->SecurityCheck();
$TbcPay->InitializePayment();
$Transaction = Transactions::CheckTransaction($TbcPay->OrderID);
$UserObject = Momxmarebeli::TitoMomxmarebeli($TbcPay->User);
if (!$Transaction) {
    if ($UserObject) {
        $UserObjec->Daricxva($TbcPay->Amount);
        exit;
    } else {
        $TbcPay->FailUser();
    }
} else {
    $TbcPay->ShowOrderFail()();
}
Exemple #23
0
 public function getTotal($from_date, $to_date)
 {
     $sum = 0;
     $yiidatetimesec = Yii::app()->locale->getDateFormat('yiidatetimesec');
     $phpdbdatetime = Yii::app()->locale->getDateFormat('phpdbdatetime');
     $from_date = date($phpdbdatetime, CDateTimeParser::parse($from_date, $yiidatetimesec));
     $to_date = date($phpdbdatetime, CDateTimeParser::parse($to_date, $yiidatetimesec));
     $criteria = new CDbCriteria();
     $criteria->condition = "account_id = :id";
     $criteria->addCondition("valuedate BETWEEN :from_date AND :to_date");
     $criteria->params = array(':id' => $this->id, ':from_date' => $from_date, ':to_date' => $to_date);
     $transactions = Transactions::model()->findAll($criteria);
     foreach ($transactions as $transaction) {
         $sum += $transaction->sum;
     }
     return $sum;
 }
 public function addPhysicalCheckDebit($hash_in)
 {
     $hash_out = Transactions::createPhysicalCheckDebitHash($hash_in);
     $this->addTransaction($hash_out, $hash_in, 'physicalCheckDebit');
     $this->counts_and_amounts['physicalCheckDebit']['count'] += 1;
     $this->counts_and_amounts['physicalCheckDebit']['amount'] += $hash_out['amount'];
 }
Exemple #25
0
 public function make()
 {
     $this->id = rand(0, 999999);
     //$this->iniArr=array('b110'=>0,'b100'=>0,'m100'=>0,'c100'=>0,'d100'=>0,'d110'=>0,'d120'=>0,);
     //$this->docArr=array(0=>0,305=>0,300=>0,);
     $bkmv = '';
     //$this->line=1;
     $yiidatetimesec = Yii::app()->locale->getDateFormat('yiidatetimesec');
     $phpdbdatetime = Yii::app()->locale->getDateFormat('phpdbdatetime');
     $from_date = date($phpdbdatetime, CDateTimeParser::parse($this->from_date . ":00", $yiidatetimesec));
     $to_date = date($phpdbdatetime, CDateTimeParser::parse($this->to_date . ":00", $yiidatetimesec));
     //$types=array(3,4,9,11,13,14);
     //accounts
     $criteria = new CDbCriteria();
     $accounts = Accounts::model()->findAll($criteria);
     $record = array('id' => 'B110', 'name' => OpenFormatType::model()->getDesc('B110'), 'count' => 0);
     foreach ($accounts as $account) {
         $this->line++;
         $bkmv .= $account->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //items
     $criteria = new CDbCriteria();
     $items = Item::model()->findAll($criteria);
     $record = array('id' => 'M100', 'name' => OpenFormatType::model()->getDesc('M100'), 'count' => 0);
     foreach ($items as $item) {
         $this->line++;
         $bkmv .= $item->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //
     //transactions
     $criteria = new CDbCriteria();
     $criteria->condition = "valuedate BETWEEN :from_date AND :to_date";
     $criteria->params = array(':from_date' => $from_date, ':to_date' => $to_date);
     $transactions = Transactions::model()->findAll($criteria);
     $record = array('id' => 'B100', 'name' => OpenFormatType::model()->getDesc('B100'), 'count' => 0);
     foreach ($transactions as $transaction) {
         $this->line++;
         $bkmv .= $transaction->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //docs
     $criteria = new CDbCriteria();
     $criteria->condition = "due_date BETWEEN :from_date AND :to_date";
     $criteria->params = array(':from_date' => $from_date, ':to_date' => $to_date);
     $docs = Docs::model()->findAll($criteria);
     //OpenFormatType::model()->getDesc('C100')
     $record = array('id' => 'C100', 'name' => OpenFormatType::model()->getDesc('C100'), 'count' => 0);
     $d110 = array('id' => 'D110', 'name' => OpenFormatType::model()->getDesc('D110'), 'count' => 0);
     $d120 = array('id' => 'D120', 'name' => OpenFormatType::model()->getDesc('D120'), 'count' => 0);
     foreach ($docs as $doc) {
         if ($doc->docType->openformat != '0') {
             $this->line++;
             $bkmv .= $doc->openfrmt($this->line, $from_date, $to_date);
             foreach ($doc->docDetailes as $detial) {
                 $this->line++;
                 $bkmv .= $detial->openfrmt($this->line, $from_date, $to_date);
                 $d110['count']++;
             }
             foreach ($doc->docCheques as $detial) {
                 $this->line++;
                 $bkmv .= $detial->openfrmt($this->line, $from_date, $to_date);
                 $d120['count']++;
             }
             $type = $doc->getType();
             $this->docArr[$type] = isset($this->docArr[$type]) ? $this->docArr[$type] + 1 : 0;
             $this->docSumArr[$type] = isset($this->docSumArr[$type]) ? $this->docSumArr[$type] + $doc->total : $doc->total;
             $record['count']++;
         }
     }
     $this->iniArr[] = $record;
     $this->iniArr[] = $d110;
     $this->iniArr[] = $d120;
     $company = Settings::model()->findByPk('company.name');
     //A100
     $bkmv = $company->a100(1, $this->id) . $bkmv;
     //Z900
     $bkmv = $bkmv . $company->z900($this->line + 1, $this->id, $this->line + 1);
     $bkmvFile = new Files();
     $bkmvFile->name = 'bkmvdata.txt';
     $bkmvFile->path = 'openformat/';
     //
     $bkmvFile->expire = 360;
     $bkmvFile->save();
     $bkmvFile->writeFile($bkmv);
     $this->bkmvId = $bkmvFile->id;
     //A000
     $ini = $company->a000(1, $this->id, $this->line + 1);
     foreach ($this->iniArr as $line) {
         $ini .= $line['id'] . sprintf("%015d", $line['count']) . "\r\n";
     }
     //Z
     $iniFile = new Files();
     $iniFile->name = 'ini.txt';
     $iniFile->path = 'openformat/';
     //
     $iniFile->expire = 360;
     $iniFile->save();
     $iniFile->writeFile($ini);
     $this->iniId = $iniFile->id;
     return $this->id;
 }
Exemple #26
0
 function Transactions_byProject($prjNo, $startdate, $enddate)
 {
     $this->prjNo = $prjNo;
     parent::Transactions("AC_ID1={$prjNo}", $startdate, $enddate);
 }
 public function action_index()
 {
     $accounting_node = $this->xml_content->appendChild($this->dom->createElement('accounting'));
     xml::to_XML(Transactions::get(NULL, 'IF(transfer_date = 0,1,0),transfer_date;'), $accounting_node, 'entry', 'id');
 }
Exemple #28
0
<?php

//Get classes
require_once '../api.php';
//Request
$request = RestUtils::processRequest();
$transactions = new Transactions();
switch ($request->getMethod()) {
    /*
     * ======================================
     * GET method
     * ======================================
     */
    case 'get':
        //Get by Id
        if (!empty($_GET['id'])) {
            if ($_GET['id'] == 'types') {
                echo json_encode($transactions->getTypes());
            }
            //Get ALL
        } else {
            isset($_GET['count']) ? $count = intval($_GET['count']) : ($count = 10);
            isset($_GET['from']) ? $from = $_GET['from'] : ($from = "");
            isset($_GET['to']) ? $to = $_GET['to'] : ($to = "");
            isset($_GET['account']) ? $account = $_GET['account'] : ($account = "");
            echo json_encode($transactions->get($count, $from, $to, $account));
        }
        break;
        /*
         * ======================================
         * PUT method
Exemple #29
0
 public static function getMax()
 {
     $model = new Transactions();
     $criteria = new CDbCriteria();
     $criteria->select = 'max(num) AS maxNum';
     $row = $model->model()->find($criteria);
     return $row['maxNum'];
 }
Exemple #30
0
 public function pay()
 {
     $this->dates();
     $yiidatetimesec = Yii::app()->locale->getDateFormat('yiidatetimesec');
     $phpdbdatetime = Yii::app()->locale->getDateFormat('phpdbdatetime');
     $date = date($phpdbdatetime, CDateTimeParser::parse($this->to_date, $yiidatetimesec));
     /*
               $tnum = Transaction(0, TRAN_PRETAX, IRS, $ref1, $ref2, $date, $details, $this->tax_sum);
               $tnum = Transaction($tnum, TRAN_PRETAX, PRETAX, $ref1, $ref2, $date, $details, $this->tax_sum * -1.0);
               $tnum = Transaction($tnum, TRAN_PRETAX, IRS, $ref1, $ref2, $date, $details, $this->custtax_total);
               $tnum = Transaction($tnum, TRAN_PRETAX, CUSTTAX, $ref1, $ref2, $date, $details, $this->custtax_total * -1.0);
     */
     $irs = Yii::app()->user->settings['company.acc.irs'];
     $pretax = Yii::app()->user->settings['company.acc.pretax'];
     $custtax = Yii::app()->user->settings['company.acc.custtax'];
     $cur = Yii::app()->user->settings['company.cur'];
     $owner = Yii::app()->user->id;
     $line = 1;
     $accout = new Transactions();
     $accout->account_id = $irs;
     //IRS
     $accout->type = 14;
     //$accout->refnum1 = $this->from_date;
     //$accout->refnum2 = $this->to_date;
     $accout->valuedate = $date;
     $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year;
     $accout->currency_id = $cur;
     $accout->owner_id = $owner;
     $accout->linenum = $line;
     $accout->sum = $this->tax_sum;
     $line++;
     $num = $accout->save();
     $accout = new Transactions();
     $accout->account_id = $pretax;
     //PRETAX
     $accout->type = 14;
     $accout->num = $num;
     //$accout->refnum1 = $this->from_date;
     //$accout->refnum2 = $this->to_date;
     $accout->valuedate = $date;
     $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year;
     $accout->currency_id = $cur;
     $accout->owner_id = $owner;
     $accout->linenum = $line;
     $accout->sum = $this->tax_sum * -1;
     $line++;
     $accout->save();
     $accout = new Transactions();
     $accout->account_id = $irs;
     //IRS
     $accout->type = 14;
     $accout->num = $num;
     //$accout->refnum1 = $this->from_date;
     //$accout->refnum2 = $this->to_date;
     $accout->valuedate = $date;
     $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year;
     $accout->currency_id = $cur;
     $accout->owner_id = $owner;
     $accout->linenum = $line;
     $accout->sum = $this->custtax_total;
     $line++;
     $accout->save();
     $accout = new Transactions();
     $accout->account_id = $custtax;
     //CUSTTAX
     $accout->type = 14;
     $accout->num = $num;
     //$accout->refnum1 = $this->from_date;
     //$accout->refnum2 = $this->to_date;
     $accout->valuedate = $date;
     $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year;
     $accout->currency_id = $cur;
     $accout->owner_id = $owner;
     $accout->linenum = $line;
     $accout->sum = $this->custtax_total * -1.0;
     $line++;
     $accout->save();
 }