当前位置: 首页>>代码示例>>PHP>>正文


PHP Period::getPeriodID方法代码示例

本文整理汇总了PHP中Period::getPeriodID方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::getPeriodID方法的具体用法?PHP Period::getPeriodID怎么用?PHP Period::getPeriodID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Period的用法示例。


在下文中一共展示了Period::getPeriodID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Period

<?php

include "system.php";
include "class/Accounts.php";
include "chart/libchart/classes/libchart.php";
include "../system/class/Period.php";
$period = new Period();
$acc = new Accounts();
$year = date("Y", time());
$month = date("m", time());
$year = 2009;
$month = 6;
$period1 = $period->getPeriodID($year, $month);
for ($i = 0; $i < 6; $i++) {
    $year = date("Y", time());
    $month = date("m", time() - $i);
    if ($month <= 0) {
        $month = $month + 12;
        $year = $year - 1;
    }
    //$period1=$period->getPeriodID($year,$month);
    eval('$period' . (6 - $i) . "=" . $period->getPeriodID($year, $month) . ';');
    eval('$periodname' . (6 - $i) . "=" . $year . '-' . $month . ';');
}
echo "\n" . ($sales1 = $acc->getSalesInPeriod($period1));
echo "\n" . ($expenses1 = $acc->getCOGSAndExpensesInPeriod($period1));
echo "\n" . ($sales2 = $acc->getSalesInPeriod($period2));
echo "\n" . ($expenses2 = $acc->getCOGSAndExpensesInPeriod($period2));
echo "\n" . ($sales3 = $acc->getSalesInPeriod($period3));
echo "\n" . ($expenses3 = $acc->getCOGSAndExpensesInPeriod($period3));
echo "\n" . ($sales4 = $acc->getSalesInPeriod($period4));
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:31,代码来源:1chartsalesexpenses_6month.php

示例2: Period

 include "../system/class/pchart/pChart/pChart.class";
 include "../system/class/Period.php";
 $period = new Period();
 $acc = new Accounts();
 $orimonth = right(left(getDateSession(), 7), 2);
 $oriyear = left(getDateSession(), 4);
 //$period1=$period->getPeriodID($year,$month);
 for ($i = 5; $i >= 0; $i--) {
     $year = $oriyear;
     $month = $orimonth - $i;
     if ($month <= 0) {
         $month = $month + 12;
         $year = $year - 1;
     }
     //$period1=$period->getPeriodID($year,$month);
     eval("\$period" . (5 - $i) . "=" . $period->getPeriodID($year, $month) . ";");
     eval("\$periodname" . (5 - $i) . "=\$year.'-'.\$month;");
 }
 $pl0 = $acc->getProfitAndLostInPeriod($period0);
 $pl1 = $acc->getProfitAndLostInPeriod($period1);
 $pl2 = $acc->getProfitAndLostInPeriod($period2);
 $pl3 = $acc->getProfitAndLostInPeriod($period3);
 $pl4 = $acc->getProfitAndLostInPeriod($period4);
 $pl5 = $acc->getProfitAndLostInPeriod($period5);
 /*echo <<< EOF
 $period0,$periodname0,$sales0,$expenses0<br/>
 $period1,$periodname1,$sales1,$expenses1<br/>
 $period2,$periodname2,$sales2,$expenses2<br/>
 $period3,$periodname3,$sales3,$expenses3<br/>
 $period4,$periodname4,$sales4,$expenses4<br/>
 $period5,$periodname5,$sales5,$expenses5<br/>
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:31,代码来源:chartincomestatment.php

示例3: 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;
 }
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:86,代码来源:AccountsAPI.php


注:本文中的Period::getPeriodID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。