SKU 指定包材数据明细列表

本文介绍了一个用于展示产品包材数据明细的Web应用实现方法,包括控制器代码与前端页面渲染逻辑。通过设置不同的参数,可以获取指定时间段内特定产品的包材库存变动详情。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//Controller
class Product_PackageController extends Zend_Controller_Action {
    //指定包材数据明细列表
    public function packagingMaterialsDetailListAction() {
        $warehouseId = $this->_request->getParam('userWarehouse', '');
        $productSku = $this->_request->getParam('product_sku', '');
        $startDate = $this->_request->getParam('start_date', '');
        $endDate = $this->_request->getParam('end_date', '');
        $combinat = array(
            'warehouse_id' => $warehouseId,
            'product_sku' => $productSku,
            'start_date' => $startDate . ' 00:00:00',
            'end_date' => $endDate . ' 23:59:59',
        );
        $pmIds = Product_Service_PackagingMaterials::getCombination($combinat, '*');
        $data[0] = array(
            'pm_create_date' => date('Y-m-t', strtotime('-1 months', strtotime($startDate))),
            'pm_type' => 10,
            'pm_end_semester_quantity' => empty($pmIds[0]['pm_beginning_quantity']) ? 0 : $pmIds[0]['pm_beginning_quantity'],
            'pm_end_semester_price' => empty($pmIds[0]['pm_beginning_price']) ? 0 : $pmIds[0]['pm_beginning_price'],
            'pm_end_semester_gold' => empty($pmIds[0]['pm_beginning_gold']) ? 0 : $pmIds[0]['pm_beginning_gold'],
        );
        $this->view->data = array_merge($data, $pmIds);
        $this->view->product_sku = $productSku;
        echo $this->view->render('product/package/packaging-materials-detail-list.tpl');
    }
}


js
//包材数据明细列表
function loadData() {
    loading();
    $.ajax({
        url: "/product/package/packaging-materials-list",
        async: false,
        dataType: "json",
        type: "post",
        data: $("#sForm").serializeArray(),
        success: function (json) {
            var Html = "";
            if (json.ask) {
                $.each(json.data, function (key, value) {
                    $.each(value, function (ke, valu) {
                        Html += "<tr>";
                        Html += "<td>" + key + "</td>";
                        Html += "<td onclick='packagingMaterialsDetailList(\"" + ke + "\", \"" + valu.start_date + "\", \"" + valu.end_date + "\")' style='cursor: pointer'>" + ke + "</td>";
                        Html += "<td>" + valu.beginning_inventory_quantity + "</td>";
                        Html += "<td>" + valu.beginning_inventory_gold + "</td>";
                        Html += "<td>" + valu.into_quantity_count + "</td>";
                        Html += "<td>" + valu.into_gold_count + "</td>";
                        Html += "<td>" + valu.outbound_quantity_count + "</td>";
                        Html += "<td>" + valu.outbound_gold_count + "</td>";
                        Html += "<td>" + valu.end_semester_inventory_quantity + "</td>";
                        Html += "<td>" + valu.end_semester_inventory_gold + "</td>";
                        Html += "</tr>";
                    });
                });
            } else {
                alertTip(json.msg);
                Html += "<tr><td colspan='100%'>" + json.msg + "</td></tr>";
            }
            $("#loadData").html(Html);
        }
    });
    closeLoading();
}

//该包材的数据明细列表
function packagingMaterialsDetailList(product_sku, start_date, end_date) {
    var warehouse_id = $("#userWarehouse").find("option:selected").val();
    window.open("/product/package/packaging-materials-detail-list/product_sku/" + product_sku + "/userWarehouse/" + warehouse_id + "/start_date/" + start_date + "/end_date/" + end_date);
}


Html
<!DOCTYPE html>
<html>
    <head>
        <title><{$product_sku}> 包材数据明细列表</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style type="text/css">
            #customers{
                font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
                width: 50%;
                border-collapse: collapse;
            }
            #customers th{
                font-size: 1.1em;
                background-color: #B8CCE4;
                text-align: center;
            }
            #customers td, #customers th{
                font-size: 1em;
                border: 1px solid #000;
            }
            .right{
                text-align: right;
            }
        </style>
    </head>
    <body>
        <table id="customers">
            <tr>
                <th>SKU</th>
                <th colspan="2" style="color: #ffffff"><{$product_sku}></th>
                <th colspan="3">本月入库</th>
                <th colspan="3">本月出库</th>
                <th colspan="3">期末结存</th>
                <th rowspan="2">备注</th>
            </tr>
            <tr>
                <th>序号</th>
                <th style="width: 3.5cm">日期</th>
                <th>摘要</th>
                <th>数量</th>
                <th>单价</th>
                <th>金额</th>
                <th>数量</th>
                <th>单价</th>
                <th>金额</th>
                <th>数量</th>
                <th>单价</th>
                <th>金额</th>
            </tr>
            <{foreach from=$data key="key" item="value"}>
            <tr>
                <td><{if $key > 0}><{$key}><{/if}></td>
                <td><{$value.pm_create_date}></td>
                <td><{if $value.pm_type == 0}>采购入库<{elseif $value.pm_type == 1}>领用出库<{elseif $value.pm_type == 2 || $value.pm_type == 3}>CFF 盘点<{else}>结存<{/if}></td>
                <{if $value.pm_type == 0 || $value.pm_type == 2}>
                <td class='right'><{$value.pm_quantity}></td>
                <td class='right'><{$value.pm_price}></td>
                <td class='right'><{$value.pm_gold}></td>
                <td></td>
                <td></td>
                <td></td>
                <{elseif $value.pm_type == 1 || $value.pm_type == 3}>
                <td></td>
                <td></td>
                <td></td>
                <{if $value.pm_quantity > 0}>
                <td style="color: red" class='right'>-<{$value.pm_quantity}></td>
                <td class='right'><{$value.pm_price}></td>
                <td style="color: red" class='right'>-<{$value.pm_gold}></td>
                <{else}>
                <td style="color: red" class='right'><{$value.pm_quantity}></td>
                <td class='right'><{$value.pm_price}></td>
                <td style="color: red" class='right'><{$value.pm_gold}></td>
                <{/if}>
                <{else}>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <{/if}>
                <{if $value.pm_end_semester_quantity < 0}>
                <td style="color: red" class='right'><{$value.pm_end_semester_quantity}></td>
                <td class='right'><{$value.pm_end_semester_price}></td>
                <td style="color: red" class='right'><{$value.pm_end_semester_gold}></td>
                <{else}>
                <td class='right'><{$value.pm_end_semester_quantity}></td>
                <td class='right'><{$value.pm_end_semester_price}></td>
                <td class='right'><{$value.pm_end_semester_gold}></td>
                <{/if}>
                <td><{if $key > 0}><{$value.pm_code}><{/if}></td>
            </tr>
            <{/foreach}>
        </table>
    </body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值