protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        PurchaseAskPriceModel PurchaseAskPriceM = new PurchaseAskPriceModel();

        PurchaseAskPriceM.CompanyCD  = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        PurchaseAskPriceM.AskNo      = txtAskNo.Value;
        PurchaseAskPriceM.AskTitle   = txtAskTitle.Value;
        PurchaseAskPriceM.FromType   = ddlFromType.Value;
        PurchaseAskPriceM.DeptID     = hidDeptID.Value;
        PurchaseAskPriceM.AskUserID  = hidUserID.Value;
        PurchaseAskPriceM.BillStatus = ddlBillStatus.Value;
        PurchaseAskPriceM.ProviderID = hidProviderID.Value;
        PurchaseAskPriceM.FlowStatus = ddlFlowStatus.Value;
        PurchaseAskPriceM.AskDate    = StartAskDate.Value;
        PurchaseAskPriceM.EndAskDate = EndAskDate.Value;
        PurchaseAskPriceM.EFDesc     = GetBillExAttrControl1.GetExtTxtValue;
        PurchaseAskPriceM.EFIndex    = GetBillExAttrControl1.GetExtIndexValue;

        string    OrderBy = hidOrderBy.Value;
        DataTable dt      = PurchaseAskPriceBus.GetPurchaseAskPrice(PurchaseAskPriceM, OrderBy);


        OutputToExecl.ExportToTableFormat(this, dt,
                                          new string[] { "询价单编号", "询价单主题", "供应商", "询价日期", "询价员", "当前询价次数", "金额合计", "税额合计", "含税金额合计", "单据状态", "审批状态" },
                                          new string[] { "AskNo", "AskTitle", "ProviderName", "AskDate", "AskUserName", "AskOrder", "TotalPrice", "TotalTax", "TotalFee", "BillStatusName", "FlowStatusName" },
                                          "采购询价单列表");
    }
Exemplo n.º 2
0
    protected void LoadPrintInfo()
    {
        PrintParameterSettingModel model = new PrintParameterSettingModel();

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


        //PurchaseApplyModel modelMRP = new PurchaseApplyModel();
        //PurchaseApplyModel.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        //PurchaseApplyModel.ID = this.intMrpID;

        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase =
        {
            { "{ExtField1}",  "ExtField1"      },
            { "{ExtField2}",  "ExtField2"      },
            { "{ExtField3}",  "ExtField3"      },
            { "{ExtField4}",  "ExtField4"      },
            { "{ExtField5}",  "ExtField5"      },
            { "{ExtField6}",  "ExtField6"      },
            { "{ExtField7}",  "ExtField7"      },
            { "{ExtField8}",  "ExtField8"      },
            { "{ExtField9}",  "ExtField9"      },
            { "{ExtField10}", "ExtField10"     },
            { "单据编号",         "AskNo"          },
            { "主题",           "AskTitle"       },
            { "采购类别",         "TypeName"       },
            { "供应商",          "ProviderName"   },
            { "部门",           "DeptName"       },
            { "询价员",          "AskUserName"    },
            { "询价日期",         "AskDate"        },
            { "源单类型",         "FromTypeName"   },
            { "币种",           "CurrencyName"   },
            { "询价次数",         "AskOrder"       },
            { "汇率",           "Rate"           },
            { "是否为增值税",       "ShowName"       },

            { "数量总计",         "CountTotal"     },
            { "金额总计",         "TotalPrice"     },
            { "税额合计",         "TotalTax"       },
            { "含税总额总计",       "TotalFee"       },
            { "整单折扣",         "Discount"       },
            { "折扣金额",         "DiscountTotal"  },
            { "折后含税额",        "RealTotal"      },

            { "单据状态",         "BillStatusName" },
            { "制单人",          "CreatorName"    },
            { "制单日期",         "CreateDate"     },
            { "确认人",          "ConfirmorName"  },
            { "确认日期",         "ConfirmDate"    },
            { "结单人",          "CloserName"     },
            { "结单日期",         "CloseDate"      },
            { "最后更新人",        "ModifiedUserID" },
            { "最后更新日期",       "ModifiedDate"   },
            { "备注",           "Remark"         },
        };


        string[,] aDetail;
        if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit)
        {
            aDetail = new string[, ] {
                { "物品名称", "ProductName" },
                { "颜色", "ColorName" },
                { "基本数量", "ProductCount" },
                { "交货日期", "RequireDate" },
                { "基本单位", "UnitName" },
                { "单价", "UsedPrice" },
                { "含税价", "TaxPrice" },
                { "单位", "UsedUnitName" },
                { "计划数量", "UsedUnitCount" },
                { "税率", "TaxRate" },
                { "含税金额", "TotalFee" },
                { "税额", "TotalTax" },
                { "规格", "Specification" },
            };
        }
        else
        {
            aDetail = new string[, ] {
                { "物品名称", "ProductName" },
                { "颜色", "ColorName" },
                { "计划数量", "ProductCount" },
                { "交货日期", "RequireDate" },
                { "单位", "UnitName" },
                { "单价", "UnitPrice" },
                { "含税价", "TaxPrice" },
                { "税率", "TaxRate" },
                { "含税金额", "TotalFee" },
                { "税额", "TotalTax" },
                { "规格", "Specification" },
            };
        }

        /*第二明细*/
        //string[,] aSecondDetail = {
        //                   };

        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba." + ConstUtil.CODING_RULE_TABLE_PURCHASEASKPRICE);
        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 dtMRP    = PurchaseAskPriceBus.GetPurAskPricePriByID(this.intMrpID.ToString());
        DataTable dtDetail = PurchaseAskPriceBus.GetPurAskPriceDetail(this.intMrpID.ToString());

        //DataTable PurchaseApplyPrimary = PurchaseApplyBus.GetPurchaseApply(ID);
        //DataTable PurchaseApplySource = PurchaseApplyBus.GetPurchaseApplySource(ID);
        //   DataTable PurchaseApplyDetail2 = PurchasePlanBus.GetPurchasePlanDetail(this.intMrpID.ToString());



        string strBaseFields   = "";
        string strDetailFields = "";
        /*第二明细*/
        string strDetailSecondFields = "";

        if (dbPrint.Rows.Count > 0)
        {
            isSeted.Value   = "1";
            strBaseFields   = dbPrint.Rows[0]["BaseFields"].ToString();
            strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString();
            /*第二明细*/
            strDetailSecondFields = dbPrint.Rows[0]["DetailSecondFields"].ToString();
        }
        else
        {
            isSeted.Value = "0";
            strBaseFields = "AskNo|AskTitle|TypeName|ProviderName|ShowName|TotalTax|DeptName|AskUserName|AskDate|TotalFee|CurrencyName|AskOrder|Rate|FromTypeName|CountTotal|TotalPrice|CreatorName|CreateDate|BillStatusName|ConfirmorName|ConfirmDate|CloserName|CloseDate|ModifiedUserID|ModifiedDate|Remark|Discount|DiscountTotal|RealTotal";
            /*基本信息字段+扩展信息字段*/
            if (countExt > 0)
            {
                for (int i = 0; i < countExt; i++)
                {
                    strBaseFields = strBaseFields + "|" + "ExtField" + (i + 1);
                }
            }


            if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit)
            {
                strDetailFields = "ProductName|ColorName|ProductCount|RequireDate|UsedPrice|UnitName|UsedUnitName|UsedUnitCount|TaxPrice|TotalTax|TaxRate|TotalFee";
                /*第二明细*/
                strDetailSecondFields = "ProductName|ColorName|ProductCount|RequireDate|TotalTax|ProductCount|RequireDate|UsedPrice|UsedUnitName|UsedUnitCount|TotalPrice|OrderCount|UnitName|TaxPrice|Specification";
            }
            else
            {
                strDetailFields = "ProductName|ColorName|ProductCount|RequireDate|UnitPrice|UnitName|TaxPrice|TotalTax|TaxRate|TotalFee";
                /*第二明细*/
                strDetailSecondFields = "ProductName|ColorName|ProductCount|RequireDate|TotalTax|ProductCount|RequireDate|UnitPrice|TotalPrice|OrderCount|UnitName|TaxPrice|Specification";
            }
        }

        #region 2.主表信息
        if (!string.IsNullOrEmpty(strBaseFields))
        {
            tableBase.InnerHtml = WritePrintPageTable("采购询价", strBaseFields, strDetailFields, aBase, aDetail, dtMRP, dtDetail, true);
        }
        #endregion

        #region 3.明细信息
        if (!string.IsNullOrEmpty(strDetailFields))
        {
            tableDetail.InnerHtml = WritePrintPageTable("采购询价", strBaseFields, strDetailFields, aBase, aDetail, dtMRP, dtDetail, false);
        }
        #endregion

        /*第二明细*/
        #region 4.明细信息2
        //if (!string.IsNullOrEmpty(strDetailSecondFields))
        //{
        //    tableDetail2.InnerHtml = WritePrintPageTable("采购询价", strBaseFields, strDetailSecondFields, aBase, aSecondDetail, dtMRP, PurchaseApplyDetail2, false);
        //}
        #endregion
    }