Пример #1
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        PurchaseOrderModel PurchaseOrderM = new PurchaseOrderModel();

        PurchaseOrderM.CompanyCD  = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        PurchaseOrderM.OrderNo    = txtOrderNo.Value;
        PurchaseOrderM.Title      = txtOrderTitle.Value;
        PurchaseOrderM.TypeID     = ddlTypeID.SelectedValue;
        PurchaseOrderM.DeptID     = hidDeptID.Value;
        PurchaseOrderM.Purchaser  = hidPurchaseID.Value;
        PurchaseOrderM.FromType   = ddlFromType.Value;
        PurchaseOrderM.ProviderID = hidProviderID.Value;
        PurchaseOrderM.BillStatus = ddlBillStatus.Value;
        PurchaseOrderM.FlowStatus = ddlFlowStatus.Value;
        PurchaseOrderM.ProjectID  = this.hidProjectID.Value;
        PurchaseOrderM.EFIndex    = GetBillExAttrControl1.GetExtIndexValue;
        PurchaseOrderM.EFDesc     = GetBillExAttrControl1.GetExtTxtValue;
        string OrderBy = hidOrderBy.Value;

        DataTable dt = PurchaseOrderBus.GetPurchaseOrder(PurchaseOrderM, OrderBy);

        OutputToExecl.ExportToTableFormat(this, dt,
                                          new string[] { "订单编号", "订单主题", "采购类别", "采购员", "供应商", "金额合计", "税额合计", "含税金额合计", "单据状态", "审批状态", "是否已建单" },
                                          new string[] { "OrderNo", "OrderTitle", "TypeName", "PurchaserName", "ProviderName", "TotalPrice", "TotalTax", "TotalFee", "BillStatusName", "FlowStatusName", "isOpenBillName" },
                                          "采购订单列表");
    }
    protected void btnPrint_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            //string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            string    ProductID         = HidProductID.Value;
            string    StartPurchaseDate = txtStartPurchaseDate.Value.Trim();
            string    EndPurchaseDate   = txtEndPurchaseDate.Value.Trim();
            string    orderBy           = "ProductID desc";
            DataTable dt = PurchaseOrderBus.SelectPurchaseHistoryAskPricePrint(orderBy, ProductID, StartPurchaseDate, EndPurchaseDate);
            //OutputToExecl.ExportToTableFormat(this, dt,
            //    new string[] { "物品编号", "物品名称", "规格", "单位", "最高采购价", "最低采购价", "平均采购价", "最近采购价" },
            //    new string[] { "ProductNo", "ProductName", "Specification", "UnitName", "LargeTaxPrice", "SmallTaxPrice", "AverageTaxPrice", "NewTaxPrice" },
            //    "采购价格分析");
            string[,] ht =
            {
                { "物品编号",  "ProductNo"       },
                { "物品名称",  "ProductName"     },
                { "规格",    "Specification"   },
                { "单位",    "UnitName"        },
                { "最高采购价", "LargeTaxPrice"   },
                { "最低采购价", "SmallTaxPrice"   },
                { "平均采购价", "AverageTaxPrice" },
                { "最近采购价", "NewTaxPrice"     }
            };

            ExportExcel(dt, ht, "", "采购价格统计");
        }
        catch
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Exp", "<script language=javascript>showPopup('../../../Images/Pic/Close.gif','../../../Images/Pic/note.gif','导出发生异常');</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument rd = new ReportDocument();


        int User = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;

        //设置行为参数
        string orderString = Request.Params["orderby"];                                                                             //排序
        string order       = "DESC";                                                                                                //排序:升序
        string orderBy     = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "ProductID"; //要排序的字段,如果为空,默认为"ProductID"

        if (orderString.EndsWith("_a"))
        {
            order = "ASC";//排序:降序
        }


        string ProductID         = Request.Params["ProductID"];
        string StartPurchaseDate = Request.Params["StartPurchaseDate"];
        string EndPurchaseDate   = Request.Params["EndPurchaseDate"];


        orderBy = orderBy + " " + order;
        //string temp = JsonClass.DataTable2Json();
        DataTable dt = PurchaseOrderBus.SelectPurchaseHistoryAskPricePrint(orderBy, ProductID, StartPurchaseDate, EndPurchaseDate);


        rd.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/PurchaseManager/PurchaseHistoryAskPriceInfo.rpt"));
        CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.V_PurchaseHistoryAskPriceInfo"));

        //UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
        //rd.DataDefinition.FormulaFields["Creator"].Text = "\"" + "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName + "\"";
        //绑定数据
        rd.SetDataSource(dt);
        rd.Refresh();
        this.CrystalReportViewer1.ReportSource = rd;
        string DateParam = string.Empty;

        if (!string.IsNullOrEmpty(StartPurchaseDate))
        {
            DateParam += "起始日期:" + StartPurchaseDate;
        }
        if (!string.IsNullOrEmpty(EndPurchaseDate))
        {
            DateParam += "  终止日期:" + EndPurchaseDate;
        }
        rd.SetParameterValue("StartEndDate", DateParam);
        rd.SetParameterValue("Creator", "" + "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName + "");
    }
Пример #4
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_PurchaseOrder;


        //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"       },
            { "单据编号",         "OrderNo"          },
            { "主题",           "Title"            },
            { "采购类别",         "TypeName"         },
            { "供应商",          "ProviderName"     },
            { "部门",           "DeptName"         },
            { "采购员",          "PurchaserName"    },
            { "签单日期",         "OrderDate"        },
            { "源单类型",         "FromTypeName"     },
            { "支付方式",         "MoneyTypeName"    },
            { "我方代表",         "OurDelegateName"  },
            { "对方代表",         "TheyDelegate"     },
            { "是否为增值税",       "isAddTaxName"     },
            { "交货方式",         "TakeTypeName"     },
            { "运送方式",         "CarryTypeName"    },
            { "结算方式",         "PayTypeName"      },
            { "币种",           "CurrencyTypeName" },
            { "汇率",           "Rate"             },
            { "供方订单号",        "ProviderBillID"   },

            { "数量总计",         "CountTotal"       },
            { "金额总计",         "TotalPrice"       },
            { "税额合计",         "TotalTax"         },
            { "含税总额总计",       "TotalFee"         },
            { "整单折扣",         "Discount"         },
            { "折扣金额",         "DiscountTotal"    },
            { "折后含税额",        "RealTotal"        },
            { "其他费用支出合计",     "OtherTotal"       },

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


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

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

        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba." + ConstUtil.CODING_RULE_TABLE_PURCHASEORDER);
        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    = PurchaseOrderBus.GetPurchaseOrderByID(this.intMrpID.ToString());
        DataTable dtDetail = PurchaseOrderBus.GetPurchaseOrderDetail(this.intMrpID.ToString());
        //DataTable dtp = PurchaseContractBus.SelectContract(ID);
        //DataTable dt2 = PurchaseContractBus.Details(ID);

        //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 = "OrderNo|Title|TypeName|ProviderName|isAddTaxName|MoneyTypeName|ProjectName|OtherTotal|OurDelegateName|TakeTypeName|CarryTypeName|Rate|CurrencyTypeName|PayTypeName|TheyDelegate|TotalTax|DeptName|PurchaserName|OrderDate|FromTypeName|CountTotal|TotalPrice|CreatorName|CreateDate|BillStatusName|ConfirmorName|ConfirmDate|CloserName|CloseDate|ModifiedUserID|ModifiedDate|Remark|ProviderBillID";
            /*基本信息字段+扩展信息字段*/
            if (countExt > 0)
            {
                for (int i = 0; i < countExt; i++)
                {
                    strBaseFields = strBaseFields + "|" + "ExtField" + (i + 1);
                }
            }


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

        #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
    }