function content_526616c3586904_20926076($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include 'D:\\wamp\\www\\ftpPc.valsun.cn\\lib\\template\\smarty\\plugins\\modifier.date_format.php';
        }
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
                <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                <?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

                </div>
            </div>
			<div class="servar products-servar">
								  <span>SPU:
								   <input name="combineSpu" type="combineSpu" id="combineSpu" value="<?php 
        echo $_GET['combineSpu'];
        ?>
"/>
								   </span>
                                   <span><button id='searchCombineList'/>搜索</button></span>
                                   &nbsp;
                                   <span style="color: red;" id="error"><?php 
        echo $_GET['status'];
        ?>
</span>
            </div>
            <div class="main feedback-main" >
            	<table class="products-action" cellspacing="0" width="100%">
                   <tr class="title">
					    <td>SPU</td>
                        <td>SKU</td>
                        <td>成本</td>
						<td>重量</td>
                        <td>真实料号</td>
						<td>长</td>
						<td>宽</td>
						<td>高</td>
						<td>备注</td>
						<td>组合人</td>
						<td>添加时间</td>
                        <td>操作</td>
                    </tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['combineList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                                <tr id="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
">
									<td>
									   <?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineSpu'];
            ?>

									</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineSku'];
            ?>
</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineCost'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineWeight'];
            ?>
</td>
                                    <td>
                                    <?php 
            $_smarty_tpl->tpl_vars['vv'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['vv']->_loop = false;
            $_from = OmAvailableModel::getTrueSkuForCombine($_smarty_tpl->tpl_vars['value']->value['combineSku']);
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['vv']->key => $_smarty_tpl->tpl_vars['vv']->value) {
                $_smarty_tpl->tpl_vars['vv']->_loop = true;
                ?>
                                      <?php 
                echo $_smarty_tpl->tpl_vars['vv']->value['sku'];
                ?>

                                    <?php 
            }
            ?>
                                    </td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineLength'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineWidth'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineHeight'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineNote'];
            ?>
</td>
									<td><?php 
            echo getPersonNameById($_smarty_tpl->tpl_vars['value']->value['combineUserId']);
            ?>
</td>
                                    <td><?php 
            echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['addTime'], "Y-m-d H:i");
            ?>
</td>
									<td>
                                        <input type="button" onclick="window.location.href = 'index.php?mod=goods&act=updateCombine&id=<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
'" value="修改"/>
                                    </td>
                                </tr>
                                <?php 
        }
        ?>
                </table>
            </div>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
					<?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
    }
예제 #2
0
파일: functions.php 프로젝트: ohjack/newErp
function getTruePMCWForCombineSku($combineSku)
{
    $trueSkuList = OmAvailableModel::getTrueSkuForCombine($combineSku);
    if (empty($trueSkuList)) {
        return 0;
    }
    $countTrueSkuList = count($trueSkuList);
    $array = array();
    $pmTotalCost = 0;
    //包材总成本
    $pmTotalWeight = 0;
    //包材总重量
    foreach ($trueSkuList as $value) {
        $sku = $value['sku'];
        $count = intval($value['count']);
        $tName = 'pc_goods';
        $select = 'pmId,pmCapacity';
        $where = "WHERE sku='{$sku}'";
        $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
        $pmId = $skuList[0]['pmId'];
        $pmId = intval($pmId);
        //取得对应sku的pmId,和pmCapacity
        $pmCapacity = $skuList[0]['pmCapacity'];
        $pmCapacity = intval($pmCapacity) ? intval($pmCapacity) : 1;
        //容量为空,则默认为1
        if ($pmId > 0) {
            $tName = 'pc_packing_material';
            $select = 'pmName,pmWeight,pmCost';
            $where = "WHERE id='{$pmId}'";
            $pmList = OmAvailableModel::getTNameList($tName, $select, $where);
            if (!empty($pmList)) {
                $pmName = $pmList[0]['pmName'];
                //包材名称
                $pmWeight = $pmList[0]['pmWeight'];
                //该真实sku下对应包材重量
                $pmCost = $pmList[0]['pmCost'];
                //该真实sku下对应包材价格
                //下面求出该真实料号及数量要对应包材的个数
                $pmCount = ceil($count / $pmCapacity);
                //sku数量/包材容量,取整 得到包材个数
                $pmTotalCost += $pmCost * $pmCount;
                $pmTotalWeight += $pmWeight * $pmCount;
            }
        }
    }
    $array['pmTotalCost'] = $pmTotalCost / $countTrueSkuList;
    $array['pmTotalWeight'] = $pmTotalWeight / $countTrueSkuList;
    return $array;
}
예제 #3
0
 public function view_getCombineList()
 {
     //调用action层, 获取列表数据
     $searchComField = isset($_GET['searchComField']) ? post_check($_GET['searchComField']) : '';
     $fieldValue = isset($_GET['fieldValue']) ? post_check($_GET['fieldValue']) : '';
     $flag = false;
     $tName = 'pc_goods_combine';
     $where = 'where is_delete=0 ';
     if (!empty($fieldValue)) {
         if (intval($searchComField) == 1) {
             $where .= "and combineSpu='{$fieldValue}' ";
             $flag = true;
         } elseif (intval($searchComField) == 2) {
             $tmpTName = 'pc_sku_combine_relation';
             $tmpSelect = 'combineSku';
             $tmpWhere = "WHERE sku REGEXP '^{$fieldValue}(_[A-Z0-9]+)*\$'";
             $combineSkuList = OmAvailableModel::getTNameList($tmpTName, $tmpSelect, $tmpWhere);
             $combineSkuArr = array();
             foreach ($combineSkuList as $value) {
                 if (!empty($value['combineSku'])) {
                     $combineSkuArr[] = "'" . $value['combineSku'] . "'";
                 }
             }
             if (!empty($combineSkuArr)) {
                 $combineSkuStr = implode(',', $combineSkuArr);
                 $where .= "and combineSku in({$combineSkuStr}) ";
                 $flag = true;
             } else {
                 $where .= "and 1=0 ";
                 $flag = true;
             }
         }
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by combineSpu desc " . $page->limit;
     $select = '*';
     if ($flag == false) {
         $combineList = array();
     } else {
         $combineList = OmAvailableModel::getTNameList($tName, $select, $where);
     }
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=goods&act=getGoodsList', 'title' => '产品信息'), array('url' => 'index.php?mod=goods&act=getCombineList', 'title' => '虚拟料号管理'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 1);
     $this->smarty->assign('twovar', 12);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', '虚拟料号列表');
     if (!empty($combineList)) {
         $countCombineList = count($combineList);
         for ($i = 0; $i < $countCombineList; $i++) {
             if ($i > 0 && $combineList[$i]['combineSpu'] == $combineList[$i - 1]['combineSpu']) {
                 $combineList[$i]['visibleSpu'] = '';
             } else {
                 $combineList[$i]['visibleSpu'] = $combineList[$i]['combineSpu'];
             }
             $combineSku = $combineList[$i]['combineSku'];
             $cwArr = getTrueCWForCombineSku($combineSku);
             //根据combineSku返回真实的成本及重量
             $combineList[$i]['totalCost'] = $cwArr['totalCost'];
             $combineList[$i]['totalWeight'] = $cwArr['totalWeight'];
             $trueSkuList = OmAvailableModel::getTrueSkuForCombine($combineSku);
             //获取真实料号数组
             $combineList[$i]['trueSkuListCount'] = count($trueSkuList);
             for ($j = 0; $j < $combineList[$i]['trueSkuListCount']; $j++) {
                 $tName = 'pc_goods';
                 $select = 'goodsName';
                 $where = "WHERE sku='{$trueSkuList[$j]['sku']}'";
                 $goodsNameList = OmAvailableModel::getTNameList($tName, $select, $where);
                 $goodsName = $goodsNameList[0]['goodsName'];
                 $trueSkuList[$j]['goodsName'] = $goodsName;
             }
             $combineList[$i]['trueSkuList'] = $trueSkuList;
         }
     }
     $this->smarty->assign('combineList', empty($combineList) ? null : $combineList);
     $this->smarty->display("combineList.htm");
 }
    function content_52664d93244fa3_30432969($_smarty_tpl)
    {
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
               <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                </div>
            </div>
			<div class="servar products-servar">
			&nbsp;
			<span style="color: red;" id="error"></span>
            </div>
            <form action="index.php?mod=goods&act=updateCombineOn" method="post" id="CombineValidation">
            <div class="main products-main basic-main">
            	<table cellspacing="0" width="100%" id="updateCom">
                	<tr class="title">
                    	<td align="left" colspan="5" style="font-size:16px; font-weight:bold; padding-left:15px;">基本信息</td>
                    </tr>
                    <tr>
                        <td class="products-action" rowspan="100" style="width:450px;">

                    	</td>
                        <td width="4%"><span style="color:#F00;">*</span>SPU</td>
                        <td width="10%">
                            <input value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineSpu'];
        ?>
" disabled="disabled"/>
                            <input name="id" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['id'];
        ?>
" type="hidden"/>
                            <input name="combineSpu" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineSpu'];
        ?>
" type="hidden"/>
                        </td>
                    </tr>
                    <tr>
                        <td ><span style="color:#F00;">*</span>SKU</td>
                        <td><input class="validate[required]" name="combineSku" id="combineSku" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineSku'];
        ?>
"/></td>
                    </tr>
                    <tr>
                        <td><span style="color:#F00;">*</span>成本</td>
                        <td><input class="validate[required,custom[number],min[0.001]] text-input" name="combineCost" id="combineCost" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineCost'];
        ?>
"/></td>

                    </tr>
                    <tr>
                        <td><span style="color:#F00;">*</span>重量</td>
                        <td><input class="validate[required,custom[number],min[0.001]] text-input" name="combineWeight" id="combineWeight" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineWeight'];
        ?>
"/></td>
                    </tr>
                    <tr>
                        <td><span style="color:#F00;"></span>长</td>
                        <td><input class="validate[option,custom[number],min[0]] text-input" name="combineLength" id="combineLength" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineLength'];
        ?>
"/></td>
                    </tr>
                    <tr>
                        <td><span style="color:#F00;"></span>宽</td>
                        <td><input class="validate[option,custom[number],min[0]] text-input" name="combineWidth" id="combineWidth" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineWidth'];
        ?>
"/></td>
                    </tr>
                    <tr>
                        <td><span style="color:#F00;"></span>高</td>
                        <td><input class="validate[option,custom[number],min[0]] text-input" name="combineHeight" id="combineHeight" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineHeight'];
        ?>
"/></td>
                    </tr>
                    <tr>
                        <td><span style="color:#F00;"></span>备注</td>
                        <td><input name="combineNote" id="combineNote" value="<?php 
        echo $_smarty_tpl->tpl_vars['combine']->value['combineNote'];
        ?>
"/></td>
                    </tr>
                    <tr><td colspan="4"><input type="button" id="addElement2" value="添加真实料号"/></td></tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = OmAvailableModel::getTrueSkuForCombine($_smarty_tpl->tpl_vars['combine']->value['combineSku']);
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                    <tr><td><span style='color:#F00;'>*</span>料号</td><td><input name='sku[]' value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['sku'];
            ?>
"/></td> <td width="4%"><span style='color:#F00;'>*</span>数量</td><td><input name='count[]' class="validate[option,custom[integer],min[1]]" value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['count'];
            ?>
"/></td></tr>
                    <?php 
        }
        ?>
                </table>
                <div align="center" class="">
                	<input type="submit" value="保存"/>
                    <input type="button" value="返回" id="back"/>
                </div>
            </div>
            </form>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
    }