<?php /** * @version $Header$ * @package warehouse * @subpackage functions */ /** * required setup */ require_once '../kernel/setup_inc.php'; $gBitSystem->verifyPackage('warehouse'); if (!$gBitUser->hasUserPermission('p_warehouse_view')) { $gBitSystem->fatalError('You do not have prermission to view this package'); } require_once WAREHOUSE_PKG_PATH . 'Pallet.php'; global $gBitSystem, $gBitSmarty; $gPallet = new Pallet(); /* Process the input parameters this page accepts */ if (!empty($_REQUEST['pallet_id'])) { $gBitSmarty->assign_by_ref('gPalletId', $_REQUEST['pallet_id']); } $palletList = $gPallet->getList($_REQUEST); // Pagination Data $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']); $gBitSmarty->assign('palletList', $palletList); // Display the template $gDefaultCenter = "bitpackage:warehouse/list_pallets.tpl"; $gBitSmarty->assign_by_ref('gDefaultCenter', $gDefaultCenter); $gBitSystem->display('bitpackage:kernel/dynamic.tpl', 'List Pallet Locations', array('display_mode' => 'list'));
* Copyright (c) 2006 bitweaver.org * All Rights Reserved. See below for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. * * @package warehouse * @subpackage functions */ /** * required setup */ require_once '../kernel/setup_inc.php'; include_once WAREHOUSE_PKG_PATH . 'Pallet.php'; $gBitSystem->verifyPackage('warehouse'); $gBitSystem->verifyPermission('p_warehouse_view'); if (!empty($_REQUEST['pallet_id'])) { $gPallet = new Pallet($_REQUEST['pallet_id'], $_REQUEST['content_id']); $gPallet->load(); } else { $gPallet = new Pallet(); } $gPallet->getStockList($gPallet->mPalletId); $gPallet->getToPalletList($gPallet->mPalletId); $gPallet->getFromPalletList($gPallet->mPalletId); $gBitSmarty->assign_by_ref('palletInfo', $gPallet->mInfo); //if ( $gClient->isValid() ) { $gBitSystem->setBrowserTitle("Client Activity Record"); $gBitSystem->display('bitpackage:warehouse/show_pallet.tpl'); //} else { // header ("location: ".WAREHOUSE_PKG_URL."index.php"); // die; //}
/** * just an example * */ public static function Report($cid) { $m = InvoicePallet::model()->findByAttributes(array('id' => $cid)); $n = Supplier::model()->findByAttributes(array('number' => $m->supplier_no)); $i = Pallet::model()->findByAttributes(array('id' => $m->pid)); spl_autoload_unregister(array('YiiBase', 'autoload')); require_once Yii::getPathOfAlias('webroot') . '/assets/phpword/samples/Sample_Header.php'; spl_autoload_register(array('YiiBase', 'autoload')); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->setDefaultFontName('新宋体'); $phpWord->setDefaultFontSize(12); $phpWord->setDefaultParagraphStyle(array('align' => 'both', 'lineHeight' => '2')); $section = $phpWord->addSection(); $section->addText('开票通知', array('bold' => true, 'size' => 24), array('align' => 'center', 'space' => array('before' => 200, 'after' => 100))); $section->addText('注意:请收到立即开票!谢谢!', array('bold' => true, 'size' => 20), array('align' => 'center', 'space' => array('before' => 200, 'after' => 200))); $section->addText('TO:' . ' ' . $n->name . ' 传真:', null, array('align' => 'left')); $section->addText('公司名称:拓泓贸易(上海)有限公司', null, array('align' => 'left')); $section->addText('纳税人识别号:310112690186868', null, array('align' => 'left')); $section->addText('开票地址电话:上海市闵行区元江路5500号D1幢869室(021-54846073)', null, array('align' => 'left')); $section->addText('开户行及账号:上海浦东发展银行闵行支行 98280154740006293', null, array('align' => 'left')); $section->addTextBreak(1); $section->addText('开票资料如下:', array('bold' => true, 'size' => 16), array('align' => 'left')); $styleTable = array('borderSize' => 2, 'borderColor' => '686868', 'align' => 'center'); $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'); $styleCell = array('valign' => 'center', 'halign' => 'center'); $fontStyle = array('bold' => false, 'size' => 11, 'borderSize' => 2); $center = array('spaceBefore' => 10, 'spaceAfter' => 0, 'align' => 'center', 'valign' => 'center'); $phpWord->addTableStyle('table1', $styleTable, array('align' => 'center')); $table = $section->addTable('table1'); $table->addRow(); $table->addCell(1800)->addText('开票品名', $fontStyle, $center); $table->addCell(1000)->addText('型号', $fontStyle, $center); $table->addCell(800)->addText('数量', $fontStyle, $center); $table->addCell(800)->addText('单位', $fontStyle, $center); $table->addCell(1000)->addText('单价', $fontStyle, $center); $table->addCell(1800)->addText('总价', $fontStyle, $center); $table->addCell(2500)->addText('合同号', $fontStyle, $center); $table->addRow(); $table->addCell(1800)->addText($m->type, $fontStyle, $center); $table->addCell(1000)->addText($m->model, $fontStyle, $center); $table->addCell(800)->addText($m->num, $fontStyle, $center); $table->addCell(800)->addText($m->unit, $fontStyle, $center); $table->addCell(800)->addText($m->unit_price, $fontStyle, $center); $table->addCell(1800)->addText($m->unit_price * $m->num, $fontStyle, $center); $table->addCell(2500)->addText($i->purchase_contract_no, $fontStyle, $center); $table->addRow(); $table->addCell(1800)->addText('合计', $fontStyle, $center); $table->addCell(1000)->addText('', $fontStyle, $center); $table->addCell(800)->addText('', $fontStyle, $center); $table->addCell(800)->addText('', $fontStyle, $center); $table->addCell(800)->addText('', $fontStyle, $center); $table->addCell(1800)->addText('¥' . $m->unit_price * $m->num, $fontStyle, $center); $table->addCell(2500)->addText($i->purchase_contract_no, $fontStyle, $center); $section->addText('请开票后,全套发票寄至以下地址:', array('bold' => true, 'size' => 12), array('align' => 'left')); $section->addText('上海市闵行区曲吴路589号9号楼205', null, array('align' => 'left')); $section->addText('拓泓贸易(上海)有限公司', null, array('align' => 'left')); $section->addText('电话:021-54846073 13661561440', null, array('align' => 'left')); $section->addText('联系人:叶建伟', null, array('align' => 'left')); $section->addText('如有疑问,请今日联系!', null, array('align' => 'left')); $section->addText('日期:' . date('Y-m-d'), null, array('align' => 'left')); $fileName = "{$n->name}.doc"; // $fileName = iconv ( "utf-8", "gb2312", $fileName); // $fileName = mb_convert_encoding($fileName, "utf-8", "auto"); $absPath = Yii::getPathOfAlias('webroot'); $relPath = '/uploads/files/'; $file = $absPath . $relPath . $fileName; $fPath = $relPath . $fileName; $fName = '开票通知 - ' . date("Ymd"); $res = array('name' => $fName, 'url' => $fPath); write($phpWord, $file, $writers); return $res; }