Ejemplo n.º 1
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        StorageLossModel model = new StorageLossModel();

        model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        string LossDateStart   = string.Empty;
        string LossDateEnd     = string.Empty;
        string TotalPriceStart = string.Empty;
        string TotalPriceEnd   = string.Empty;
        string FlowStatus      = string.Empty;

        model.LossNo     = txtLossNo.Value;
        model.Title      = txtTitle.Value;
        model.DeptID     = txtDeptID.Value;
        model.StorageID  = ddlStorage.SelectedValue;
        model.Executor   = txtExecutorID.Value;
        model.ReasonType = ddlReason.SelectedValue;
        model.BillStatus = sltBillStatus.Value;
        FlowStatus       = sltFlowStatus.Value;
        LossDateStart    = txtLossDateStart.Value;
        LossDateEnd      = txtLossDateEnd.Value;
        TotalPriceStart  = txtTotalPriceStart.Value;
        TotalPriceEnd    = txtTotalPriceEnd.Value;

        string orderBy = txtorderBy.Value;

        if (!string.IsNullOrEmpty(orderBy))
        {
            if (orderBy.Split('_')[1] == "a")
            {
                orderBy = orderBy.Split('_')[0] + " asc";
            }
            else
            {
                orderBy = orderBy.Split('_')[0] + " desc";
            }
        }
        string IndexValue = GetBillExAttrControl1.GetExtIndexValue;
        string TxtValue   = GetBillExAttrControl1.GetExtTxtValue;
        string BatchNo    = this.txtBatchNo.Value.ToString();

        DataTable dt = StorageLossBus.GetStorageLossTableBycondition(model, IndexValue, TxtValue, LossDateStart, LossDateEnd, TotalPriceStart, TotalPriceEnd, FlowStatus, BatchNo, orderBy);

        OutputToExecl.ExportToTableFormat(this, dt,
                                          new string[] { "报损单编号", "报损单主题", "经办人", "报损部门", "报损仓库", "报损时间", "报损原因", "成本金额合计", "单据状态", "审批状态" },
                                          new string[] { "LossNo", "Title", "Executor", "DeptName", "StorageName", "LossDate", "ReasonTypeName", "TotalPrice", "BillStatusName", "FlowStatus" },
                                          "库存报损列表");
    }
Ejemplo n.º 2
0
    protected void LoadPrintInfo()
    {
        PrintParameterSettingModel model = new PrintParameterSettingModel();

        model.CompanyCD     = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        model.BillTypeFlag  = int.Parse(ConstUtil.BILL_TYPEFLAG_STORAGE);
        model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_LOSS;

        StorageLossModel LossM_ = new StorageLossModel();

        LossM_.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        LossM_.ID        = this.intMrpID.ToString();
        string[,] aDetail;
        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase =
        {
            { "{ExtField1}",  "ExtField1"        },
            { "{ExtField2}",  "ExtField2"        },
            { "{ExtField3}",  "ExtField3"        },
            { "{ExtField4}",  "ExtField4"        },
            { "{ExtField5}",  "ExtField5"        },
            { "{ExtField6}",  "ExtField6"        },
            { "{ExtField7}",  "ExtField7"        },
            { "{ExtField8}",  "ExtField8"        },
            { "{ExtField9}",  "ExtField9"        },
            { "{ExtField10}", "ExtField10"       },
            { "报损单编号",        "LossNo"           },
            { "报损单主题",        "Title"            },
            { "经办人",          "ExecutorName"     },
            { "报损部门",         "DeptName"         },
            { "仓库",           "StorageName"      },
            { "报损原因",         "ReasonTypeName"   },
            { "报损日期",         "LossDate"         },
            { "报损数量合计",       "CountTotal"       },
            { "报损金额合计",       "A_TotalPrice"     },
            { "制单人",          "CreatorName"      },
            { "制单日期",         "CreateDate"       },
            { "确认人",          "ConfirmorName"    },
            { "确认日期",         "ConfirmDate"      },
            { "结单人",          "CloserName"       },
            { "结单日期",         "CloseDate"        },
            { "最后更新人",        "ModifiedUserName" },
            { "最后更新日期",       "ModifiedDate"     },
            { "单据状态",         "BillStatusName"   },
            { "备注",           "Remark"           },
            { "摘要",           "Summary"          },
        };

        if (HiddenMoreUnit.Value == "True")
        {
            aDetail = new string[, ] {
                { "序号", "SortNo" },
                { "物品编号", "ProductNo" },
                { "物品名称", "ProductName" },
                { "批次", "BatchNo" },
                { "规格", "Specification" },
                { "基本单位", "UnitID" },
                { "基本数量", "ProductCount" },
                { "单位", "UsedUnitName" },
                { "报损数量", "UsedUnitCount" },
                { "成本单价", "UsedPrice" },
                { "报损金额", "B_TotalPrice" },
                { "备注", "DetaiRemark" },
            };
        }
        else
        {
            aDetail = new string[, ] {
                { "序号", "SortNo" },
                { "物品编号", "ProductNo" },
                { "物品名称", "ProductName" },
                { "批次", "BatchNo" },
                { "规格", "Specification" },
                { "单位", "UnitID" },
                { "报损数量", "ProductCount" },
                { "成本单价", "UnitPrice" },
                { "报损金额", "B_TotalPrice" },
                { "备注", "DetaiRemark" },
            };
        }



        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = XBase.Business.Office.SupplyChain.TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.StorageLoss");
        if (dtExtTable.Rows.Count > 0)
        {
            for (int i = 0; i < dtExtTable.Rows.Count; i++)
            {
                for (int x = 0; x < (aBase.Length / 2) - 15; x++)
                {
                    if (x == i)
                    {
                        aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString();
                        countExt++;
                    }
                }
            }
        }
        #endregion
        DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model);
        DataTable dtMain  = StorageLossBus.GetStorageLossDetailInfo(LossM_);
        // DataTable dtDetail = MRPBus.GetMRPDetailInfo(modelMRP);
        string strBaseFields   = "";
        string strDetailFields = "";

        if (dbPrint.Rows.Count > 0)
        {
            isSeted.Value   = "1";
            strBaseFields   = dbPrint.Rows[0]["BaseFields"].ToString();
            strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString();
        }
        else
        {
            #region 未设置过打印模板设置 默认显示所有的
            isSeted.Value = "0";

            /*未设置过打印模板设置时,默认显示的字段  基本信息字段*/
            for (int m = 10; m < aBase.Length / 2; m++)
            {
                strBaseFields = strBaseFields + aBase[m, 1] + "|";
            }
            /*未设置过打印模板设置时,默认显示的字段 基本信息字段+扩展信息字段*/
            if (countExt > 0)
            {
                for (int i = 0; i < countExt; i++)
                {
                    strBaseFields = strBaseFields + "ExtField" + (i + 1) + "|";
                }
            }
            /*未设置过打印模板设置时,默认显示的字段 明细信息字段*/
            for (int n = 0; n < aDetail.Length / 2; n++)
            {
                strDetailFields = strDetailFields + aDetail[n, 1] + "|";
            }
            #endregion
        }

        #region 主表信息
        if (!string.IsNullOrEmpty(strBaseFields))
        {
            tableBase.InnerHtml = WritePrintPageTable("库存报损单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMain, dtMain, true);
        }
        #endregion

        #region 明细信息
        if (!string.IsNullOrEmpty(strDetailFields))
        {
            tableDetail.InnerHtml = WritePrintPageTable("库存报损单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMain, dtMain, false);
        }
        #endregion
    }