protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));

            int count = 0;
            DataSet ds = Report.SaleByItemCode(session, startDate, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_ByItem_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYITM_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.Number, "销售数量", "SaleQty"),
                        new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                        new DownloadFormat(DataType.Number, "退回数量", "RtnQty"),
                        new DownloadFormat(DataType.Number, "退回金额", "RtnAmt")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", null);
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int count = 0;
            DataSet ds = Report.SaleByCategoryStat(session, startDate, endDate, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_ByCat_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYCAT_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.Text, "产品类别", "CatName"),
                        new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                        new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                        new DownloadFormat(DataType.Number, "总采购", "PurQty"),
                        new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
                        new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
                        new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
                        new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
                        new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count = 0;
            DataSet ds    = null;
            ds = Report.SaleBySetCodeStat(session, startDate, endDate, "%" + this.txtItemCode.Text.Trim() + "%", -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_BySet_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSET_",
                                                       new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "整套退(套)", "RtnQty"),
                new DownloadFormat(DataType.Number, "部分退(套)", "PartRtnQty"),
                new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
                new DownloadFormat(DataType.Number, "换货量(套)", "ExcgQty"),
                new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
Example #4
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         SavePurchaseGroup();
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            int count = 0;
            DataSet ds = this.Query(session, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("PO_Receive_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_RCV_SUM_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                        new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Number, "总收货数量", "TransQty"),
                        new DownloadFormat(DataType.Number, "含税总金额", "TaxInAmt"),
                        new DownloadFormat(DataType.Number, "税额", "TaxAmt"),
                        new DownloadFormat(DataType.Number, "成本金额", "TaxExAmt")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
Example #6
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleBySKUStat(session, startDate, endDate, this.txtItemCode.Text, Cast.Enum <Report_SaleByCode_OrderBy>(this.drpSort.SelectedValue), this.chkIncludeNoSale.Checked, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_BySKU_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSKU_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "总采购", "PurQty"),
                new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
                new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
                new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
                new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
                new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
                new DownloadFormat(DataType.Number, "现有库存", "StoQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
Example #7
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            int count = 0;
            DataSet ds = this.QueryData(session, 65530, 1, false, ref count);
            string fileName = DownloadUtil.DownloadXls("PO_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.Text, "采购订单", "OrderNumber"),
                        new DownloadFormat(DataType.NumberText, "行号", "LineNumber"),
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.NumberText, "颜色", "ColorCode"),
                        new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Text, "商品名称", "ItemName"),
                        new DownloadFormat(DataType.Number, "采购数量", "PurchaseQty"),
                        new DownloadFormat(DataType.Number, "单价", "Price"),
                        new DownloadFormat(DataType.Number, "金额", "TaxInclusiveAmt"),
                        new DownloadFormat(DataType.Date, "收货时间", "ActualDate"),
                        new DownloadFormat(DataType.Number, "收货数量", "IQCQty"),
                        new DownloadFormat(DataType.Number, "收货金额", "IQCAMT"),
                        new DownloadFormat(DataType.Number, "差异数量", "DiffQty")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtStartDate", "txtEndDate");
    }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         SavePurchaseGroup();
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        using (ISession session = new Session())
        {
            bool deleted = false;
            try
            {
                session.BeginTransaction();
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    if (chk != null && chk.Checked && chk.Value.Trim().Length > 0)
                    {
                        StockInHead.Delete(session, chk.Value.Trim());
                        deleted = true;
                    }
                }

                session.Commit();
                if (deleted)
                {
                    WebUtil.ShowMsg(this, "选择的入库单已经删除");
                    this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
                }
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
Example #10
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);

            int     count    = 0;
            DataSet ds       = Report.GiftSale(session, startDate, endDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Gift_Sale_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_GIFT_SALE_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "数量", "Qty"),
                new DownloadFormat(DataType.Number, "平均成本", "AvgPrice"),
                new DownloadFormat(DataType.Number, "成本金额", "CostAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
 //MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one.
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         SaveData();
     }
 }
Example #12
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate = Cast.DateTime(this.txtDateTo.Text, defaultDate);

            int count=0;
            DataSet ds = Report.GiftSale(session, startDate, endDate, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Gift_Sale_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_GIFT_SALE_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                        new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Number, "数量", "Qty"),
                        new DownloadFormat(DataType.Number, "平均成本", "AvgPrice"),
                        new DownloadFormat(DataType.Number, "成本金额", "CostAmt")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
Example #13
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         TransTypeDef def = new TransTypeDef();
         def.TransTypeCode   = this.TransTypeCode;
         def.TransDefText    = this.txtText.Text.Trim();
         def.TransDefDesc    = this.txtDesc.Text.Trim();
         def.IsCostTrans     = this.drpIsCostTrans.SelectedValue == "1" ? true : false;
         def.PriceSourceType = Cast.Enum <TransTypePriceSource>(this.drpPriceSource.SelectedValue);
         def.TransProperty   = Cast.Enum <TransProperty>(this.drpTransProp.SelectedValue);
         using (ISession session = new Session())
         {
             if (this.IsNew)
             {
                 def.Create(session);
                 WebUtil.DisableControl(this.txtCode);
                 this.txtIsNew.Value = "";
             }
             else
             {
                 def.Update(session);
             }
             this.Response.Redirect("TransTypeDefManager.aspx");
         }
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                OrderTypeDef def = null;
                if (this.IsNew)
                {
                    def = new OrderTypeDef();
                    def.OrderTypeCode = this.TypeCode;
                    def.SupportApprove = false;
                    def.NeedApprove = false;
                    def.TransStepCount = 0;
                }
                else def = OrderTypeDef.Retrieve(session, this.TypeCode);
                def.TypeText = this.txtText.Text.Trim();
                def.ViewURL = this.txtUrl.Text.Trim();
                if (this.TypeCode != "SD0" && this.TypeCode != "DL2")
                    def.RuleDefineID = Cast.Int(this.drpRule.SelectedValue, def.RuleDefineID);
                if (def.SupportApprove)
                    def.NeedApprove = this.drpNeedAppr.SelectedValue == "0" ? false : true;

                if (this.IsNew) def.Create(session);
                else def.Update(session, "TypeText", "ViewURL", "RuleDefineID", "NeedApprove");
                this.Response.Redirect("OrderTypeDefManager.aspx");
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        using (ISession session = new Session())
        {
            bool deleted = false;
            try
            {
                session.BeginTransaction();
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    if (chk != null && chk.Checked && chk.Value.Trim().Length > 0)
                    {
                        StockInHead.Delete(session, chk.Value.Trim());
                        deleted = true;
                    }
                }

                session.Commit();
                if (deleted)
                {
                    WebUtil.ShowMsg(this, "ѡ��IJ�Ʒ��ⵥ�Ѿ�ɾ��");
                    this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
                }
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleByDateStat(session, startDate, endDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_ByDate_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYDATE_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "日期", "OrdDate"),
                new DownloadFormat(DataType.Number, "订单数", "OrdCount"),
                new DownloadFormat(DataType.Number, "金额(元)", "OrdAmt"),
                new DownloadFormat(DataType.Number, "销售件数合计", "LineCount")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
Example #17
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = Report.StockWarning(session, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Stock_Warn_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_WARN_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "Max.", "MaxQty"),
                new DownloadFormat(DataType.Number, "库存量", "StoQty"),
                new DownloadFormat(DataType.Number, "Safe.", "SafeQty"),
                new DownloadFormat(DataType.Number, "Min.", "MinQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
Example #18
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     using (ISession session = new Session())
     {
         try
         {
             StockInHead head = StockInHead.Retrieve(session, this.OrderNumber);
             string      msg  = "";
             session.BeginTransaction();
             if (e.CommandName == "Save")
             {
                 this.Save(session, head);
                 msg = "保存成功";
             }
             else if (e.CommandName == "Release")
             {
                 this.Confirm(session, head);
                 msg = "入库价格审核完成";
             }
             session.Commit();
             this.QueryAndBindData(session, head);
             this.SetView(head);
             WebUtil.ShowMsg(this, msg);
         }
         catch (Exception er)
         {
             session.Rollback();
             WebUtil.ShowError(this, er);
         }
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            ObjectQuery query = session.CreateObjectQuery(@"
        select m.MemberNumber as MemberNumber,m.Name as MemberName,ca.BeginAmt as BeginAmt,ca.EndAmt as EndAmt
        from MbrCashAccountBalance ca
        left join Member m on m.MemberID=ca.MemberID
        order by m.MemberNumber")
                .Attach(typeof(MbrCashAccountBalance)).Attach(typeof(Member))
                .Where(Exp.Eq("ca.PeriodID", periodId));
            if (!string.IsNullOrEmpty(this.txtMbrID.Text) && this.txtMbrID.Text.Trim().Length > 0)
                query.And(Exp.Eq("m.MemberNumber", this.txtMbrID.Text.Trim()));
            if (!string.IsNullOrEmpty(this.txtMbrName.Text) && this.txtMbrName.Text.Trim().Length > 0)
                query.And(Exp.Like("m.Name", "%" + this.txtMbrName.Text.Trim() + "%"));
            DataSet ds = query.DataSet();

            string fileName = DownloadUtil.DownloadXls("Member_Account_Balance_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_MBR_ACC_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "会员号", "MemberNumber"),
                        new DownloadFormat(DataType.Text, "会员姓名", "MemberName"),
                        new DownloadFormat(DataType.Number, "期初余额", "BeginAmt"),
                        new DownloadFormat(DataType.Number, "期末余额", "EndAmt")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            int count=0;
            DataSet ds = Report.StockWarning(session, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Stock_Warn_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_WARN_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                        new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Number, "Max.", "MaxQty"),
                        new DownloadFormat(DataType.Number, "库存量", "StoQty"),
                        new DownloadFormat(DataType.Number, "Safe.", "SafeQty"),
                        new DownloadFormat(DataType.Number, "Min.", "MinQty")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
Example #21
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         this.SetView(SavePOHead());
     }
     else if (e.CommandName == "Paid")
     {
         try
         {
             using (ISession session = new Session())
             {
                 POHead po = POHead.Retrieve(session, this.OrderNumber);
                 po.HasPaid = true;
                 po.Update(session, "HasPaid");
                 this.cmdPaid.Visible = false;
                 this.lblPaid.Text    = "是";
                 WebUtil.ShowMsg(this, "已付款操作成功");
             }
         }
         catch (Exception er)
         {
             WebUtil.ShowError(this, "操作失败:" + er.Message);
         }
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int count = 0;
            DataSet ds = Report.SaleBySKUStat(session, startDate, endDate, this.txtItemCode.Text, Cast.Enum<Report_SaleByCode_OrderBy>(this.drpSort.SelectedValue), this.chkIncludeNoSale.Checked, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_BySKU_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSKU_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                        new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                        new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                        new DownloadFormat(DataType.Number, "总采购", "PurQty"),
                        new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
                        new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
                        new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
                        new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
                        new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
                        new DownloadFormat(DataType.Number, "现有库存", "StoQty")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
Example #23
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         bool deleted = false;
         using (ISession session = new Session())
         {
             session.BeginTransaction();
             try
             {
                 foreach (RepeaterItem item in this.rptVendor.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk != null && chk.Checked)
                     {
                         int mid = Cast.Int(chk.Attributes["mid"]), lid = Cast.Int(chk.Attributes["lid"]);
                         deleted = deleted || RestrictLogis2Member.Delete(session, lid, mid) > 0;
                     }
                 }
                 session.Commit();
                 if (deleted)
                 {
                     QueryAndBindData(session, magicPagerMain.CurrentPageIndex, magicPagerMain.PageSize, true);
                 }
             }
             catch (Exception ex)
             {
                 session.Rollback();
                 WebUtil.ShowError(this, ex);
             }
         }
     }
 }
 //MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one.
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
        SaveData();
     }
 }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         bool deleted = false;
         using (ISession session = new Session())
         {
             session.BeginTransaction();
             try
             {
                 foreach (RepeaterItem item in this.rptVendor.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk != null && chk.Checked)
                     {
                         int mid = Cast.Int(chk.Attributes["mid"]), lid = Cast.Int(chk.Attributes["lid"]);
                         deleted = deleted || RestrictLogis2Member.Delete(session, lid, mid) > 0;
                     }
                 }
                 session.Commit();
                 if (deleted)
                     QueryAndBindData(session, magicPagerMain.CurrentPageIndex, magicPagerMain.PageSize, true);
             }
             catch (Exception ex)
             {
                 session.Rollback();
                 WebUtil.ShowError(this, ex);
             }
         }
     }
 }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         bool deleted = false;
         using (ISession session = new Session())
         {
             session.BeginTransaction();
             try
             {
                 foreach (RepeaterItem item in this.rpt.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0)
                     {
                         ExcelTemplate.Delete(session, Cast.Int(chk.Value));
                         deleted = true;
                     }
                 }
                 session.Commit();
                 if (deleted)
                 {
                     this.QueryAndBindData(session);
                     WebUtil.ShowMsg(this, "选择的模板文件已经被删除", "操作成功");
                 }
             }
             catch (Exception ex)
             {
                 session.Rollback();
                 WebUtil.ShowError(this, ex);
             }
         }
     }
 }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         try
         {
             using (ISession session = new Session())
             {
                 session.BeginTransaction();
                 try
                 {
                     for (int i = 0; i < this.rptSDHead.Items.Count; i++)
                     {
                         System.Web.UI.HtmlControls.HtmlInputCheckBox objCheckBox = this.rptSDHead.Items[i].FindControl("checkbox") as System.Web.UI.HtmlControls.HtmlInputCheckBox;
                         if (objCheckBox.Checked)
                             INVCheckHead.Delete(session, objCheckBox.Attributes["value"].Trim());
                     }
                     session.Commit();
                     QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
                 }
                 catch (Exception ex)
                 {
                     session.Rollback();
                     throw ex;
                 }
             }
         }
         catch (Exception ex)
         {
             WebUtil.ShowError(this, "ɾ��ʧ��,�������Ա��ϵ!\r\nʧ����Ϣ:" + ex.Message);
             return;
         }
     }
 }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     using (ISession session = new Session())
     {
         try
         {
             StockInHead head = StockInHead.Retrieve(session, this.OrderNumber);
             string msg = "";
             session.BeginTransaction();
             if (e.CommandName == "Save")
             {
                 this.Save(session, head);
                 msg = "����ɹ�";
             }
             else if (e.CommandName == "Release")
             {
                 this.Confirm(session, head);
                 msg = "���۸�������";
             }
             session.Commit();
             this.QueryAndBindData(session, head);
             this.SetView(head);
             WebUtil.ShowMsg(this, msg);
         }
         catch (Exception er)
         {
             session.Rollback();
             WebUtil.ShowError(this, er);
         }
     }
 }
Example #29
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = this.QueryData(session, 65530, 1, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("PO_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "采购订单", "OrderNumber"),
                new DownloadFormat(DataType.NumberText, "行号", "LineNumber"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Text, "商品名称", "ItemName"),
                new DownloadFormat(DataType.Number, "采购数量", "PurchaseQty"),
                new DownloadFormat(DataType.Number, "单价", "Price"),
                new DownloadFormat(DataType.Number, "金额", "TaxInclusiveAmt"),
                new DownloadFormat(DataType.Date, "收货时间", "ActualDate"),
                new DownloadFormat(DataType.Number, "收货数量", "IQCQty"),
                new DownloadFormat(DataType.Number, "收货金额", "IQCAMT"),
                new DownloadFormat(DataType.Number, "差异数量", "DiffQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtStartDate", "txtEndDate");
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            int count = 0;
            DataSet ds = Report.StockSaleDiff(session, Cast.Int(this.drpSort.SelectedValue), this.chkOnlyStoLack.Checked, -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Stock_Sale_Diff_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_SALE_DIFF_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                        new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                        new DownloadFormat(DataType.Text, "名称", "ItemName"),
                        new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                        new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                        new DownloadFormat(DataType.Number, "当前定购数量", "OrdQty"),
                        new DownloadFormat(DataType.Number, "暂存架待发数量", "TempQty"),
                        new DownloadFormat(DataType.Number, "库存数量", "StoQty"),
                        new DownloadFormat(DataType.Number, "缺货数量", "LackQty")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = Report.StockSaleDiff(session, Cast.Int(this.drpSort.SelectedValue), this.chkOnlyStoLack.Checked, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Stock_Sale_Diff_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_SALE_DIFF_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "当前定购数量", "OrdQty"),
                new DownloadFormat(DataType.Number, "暂存架待发数量", "TempQty"),
                new DownloadFormat(DataType.Number, "库存数量", "StoQty"),
                new DownloadFormat(DataType.Number, "缺货数量", "LackQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                OrderRuleDef def = null;
                if (this.IsNew) def = new OrderRuleDef();
                else def = OrderRuleDef.Retrieve(session, this.RuleDefId);
                def.RuleDefineText = this.txtText.Text.Trim();
                def.UsePrefix = this.drpUsePrefix.SelectedValue == "1" ? true : false;
                if (def.UsePrefix) def.PrefixValue = this.txtPrefix.Text.Trim();
                def.UseTimeStamp = this.drpUseTimeStamp.SelectedValue == "1" ? true : false;
                if (def.UseTimeStamp)
                {
                    def.TimeStampPrecision = Cast.Enum<OrderRuleDefPrecision>(this.drpTimeStampPrecision.SelectedValue, def.TimeStampPrecision);
                    def.TimeStampPattern = this.txtTimeStampPattern.Text.Trim();
                }
                def.SerialLength = Cast.Int(this.txtSerialLen.Text.Trim(), def.SerialLength);

                if (this.IsNew) def.Create(session);
                else def.Update(session, "RuleDefineText", "UsePrefix", "PrefixValue", "UseTimeStamp", "TimeStampPrecision", "TimeStampPattern", "SerialLength");
                this.Response.Redirect("OrderNumberRuleDefManager.aspx");
            }
        }
    }
Example #33
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         bool deleted = false;
         using (ISession session = new Session())
         {
             session.BeginTransaction();
             try
             {
                 foreach (RepeaterItem item in this.rpt.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0)
                     {
                         ExcelTemplate.Delete(session, Cast.Int(chk.Value));
                         deleted = true;
                     }
                 }
                 session.Commit();
                 if (deleted)
                 {
                     this.QueryAndBindData(session);
                     WebUtil.ShowMsg(this, "选择的模板文件已经被删除", "操作成功");
                 }
             }
             catch (Exception ex)
             {
                 session.Rollback();
                 WebUtil.ShowError(this, ex);
             }
         }
     }
 }
Example #34
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleByItemCode(session, startDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_ByItem_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYITM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Number, "销售数量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "退回数量", "RtnQty"),
                new DownloadFormat(DataType.Number, "退回金额", "RtnAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", null);
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = this.Query(session, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("PO_Receive_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_RCV_SUM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "总收货数量", "TransQty"),
                new DownloadFormat(DataType.Number, "含税总金额", "TaxInAmt"),
                new DownloadFormat(DataType.Number, "税额", "TaxAmt"),
                new DownloadFormat(DataType.Number, "成本金额", "TaxExAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        try
        {
            if (e.CommandName == "Add" && !string.IsNullOrEmpty(this.drpArea.SelectedValue))
            {
                #region 添加库位
                using (ISession session = new Session())
                {
                    INVCheckHead head = INVCheckHead.Retrieve(session, this.OrderNumber);
                    try
                    {
                        session.BeginTransaction();
                        head.AddArea(session, this.drpArea.SelectedValue);
                        session.Commit();

                        this.BindArea(session, head);
                        this.QueryAndBindData(session, head);
                    }
                    catch (Exception er1)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er1);
                        return;
                    }
                }
                #endregion
            }
            else if (e.CommandName == "Confirm")
            {
                #region 确定开始盘点作业
                bool success = false;
                using (ISession session = new Session())
                {
                    INVCheckHead head = INVCheckHead.Retrieve(session, this.OrderNumber);
                    try
                    {
                        session.BeginTransaction();
                        head.ConfirmCheckOrder(session);
                        session.Commit();
                        success = true;
                    }
                    catch (Exception er1)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er1);
                        return;
                    }
                }
                #endregion
                if (success)
                    this.Response.Redirect("InventoryCheckDetail.aspx?ordNum="+this.OrderNumber+"&return="+WebUtil.escape(WebUtil.Param("return")));
            }
        }
        catch (Exception er)
        {
            WebUtil.ShowError(this, er);
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Save" && e.CommandName != "Delete")
        {
            WebUtil.ShowError(this, "��������");
            return;
        }
        if (this.repeatControl.Items.Count <= 0) return;

        IList<OrderApproveDef> defines = new List<OrderApproveDef>();
        foreach (RepeaterItem item in this.repeatControl.Items)
        {
            HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
            if (e.CommandName == "Delete" && chk.Checked) continue;
            HtmlInputText txt = item.FindControl("txtSeq") as HtmlInputText;
            int userId = Magic.Framework.Utils.Cast.Int(chk.Value, -1);
            if (userId <= 0)
            {
                WebUtil.ShowError(this, "�޷���ȡǩ���û����ϣ���͹���Ա��ϵ");
                return;
            }

            OrderApproveDef def = new OrderApproveDef();
            def.OrderTypeCode = this.OrderTypeCode;
            def.UserID = userId;
            def.UserSequnce = Magic.Framework.Utils.Cast.Int(txt.Value);
            defines.Add(def);
        }

        using (ISession session = new Session())
        {
            try
            {
                session.BeginTransaction();
                session.CreateEntityQuery<OrderApproveDef>()
                    .Where(Exp.Eq("OrderTypeCode", this.OrderTypeCode))
                    .Delete();
                this.SortDefines(defines);
                for (int i = 1; i <= defines.Count; i++)
                {
                    defines[i-1].StepIndex = i;
                    defines[i-1].Create(session);
                }
                session.Commit();
                if (e.CommandName == "Save")
                    WebUtil.ShowMsg(this, "ǩ��˳�򱣴�ɹ�");
                else
                    WebUtil.ShowMsg(this, "ѡ���ǩ����Ա�Ѿ�ɾ��");
                this.QueryAndBindData(session);
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
            return;

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }
            int logisId = WebUtil.ParamInt("lg", 0);
            if (logisId != -99)
                logisId = Cast.Int(this.drpLogis.SelectedValue);

            int count = 0;
            DataSet ds = Report.SaleAmt(session, startDate, endDate, logisId
                , this.txtSNNumber.Text, this.txtSONumber.Text, this.txtShippingNumber.Text
                , -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_AMT_DTL_",
                new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.Date, "发货日期", "TransDate"),
                        new DownloadFormat(DataType.NumberText, "发货单", "SNNumber"),
                        new DownloadFormat(DataType.NumberText, "订单", "SONumber"),
                        new DownloadFormat(DataType.NumberText, "运单号", "ShippingNumber"),
                        new DownloadFormat(DataType.Number, "成本金额", "CostAmt"),
                        new DownloadFormat(DataType.Number, "销售收入", "SaleAmt"),
                        new DownloadFormat(DataType.Number, "发送费", "TransportAmt"),
                        new DownloadFormat(DataType.Number, "包装费", "PackageAmt"),
                        new DownloadFormat(DataType.Number, "礼券抵扣", "CouponsAmt"),
                        new DownloadFormat(DataType.Number, "销售折扣", "DiscountAmt"),
                        new DownloadFormat(DataType.Number, "礼金支付", "EMoneyAmt"),
                        new DownloadFormat(DataType.Number, "帐户支付", "AccountReceivable"),
                        new DownloadFormat(DataType.Number, "POS机收款", "PosReceivable"),
                        new DownloadFormat(DataType.Number, "物流应收款", "LogisReceivable"),
                        new DownloadFormat(DataType.Number, "实际应收款", "ActualReceivable")
                    }, ds);
            this.frameDownload.Attributes["src"] = fileName;
            WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                ICHead head = null;
                bool created = false;
                if (this.IsNew)
                {
                    head = new ICHead();
                    head.OrderTypeCode = ICHead.ORDER_TYPE;
                    head.Status = InterchangeStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.CompanyUser = head.CreateUser;
                    head.InterchangeTime = DateTime.Now;
                    head.LogisticUser = this.txtLogisticsUser.Text.Trim();
                    head.Note = this.txtNote.Text.Trim();
                    head.LogisticCompID = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        head.AutoGenerateDetail(session);
                        session.Commit();
                        created = true;
                        //this.txtAction.Value = "edit";
                        //this.txtId.Value = head.OrderNumber;
                        //this.showInfo(session, head);
                        //this.setView(head);
                        //WebUtil.ShowMsg(this, string.Format("交接单{0}创建成功", head.OrderNumber));
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }
                }
                if (created)
                {
                    this.Response.Redirect("InterchangeLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                }

                head = ICHead.Retrieve(session, this.OrderNumber);
                head.Note = this.txtNote.Text.Trim();
                head.LogisticCompID = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
                head.LogisticUser = this.txtLogisticsUser.Text.Trim();
                head.Update(session, "Note", "LogisticCompID", "LogisticUser", "BoxNum");
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
Example #40
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                ICHead head    = null;
                bool   created = false;
                if (this.IsNew)
                {
                    head = new ICHead();
                    head.OrderTypeCode   = ICHead.ORDER_TYPE;
                    head.Status          = InterchangeStatus.New;
                    head.ApproveResult   = ApproveStatus.UnApprove;
                    head.ApproveUser     = 0;
                    head.ApproveTime     = new DateTime(1900, 1, 1);
                    head.CreateUser      = SecuritySession.CurrentUser.UserId;
                    head.CreateTime      = DateTime.Now;
                    head.CompanyUser     = head.CreateUser;
                    head.InterchangeTime = DateTime.Now;
                    head.LogisticUser    = this.txtLogisticsUser.Text.Trim();
                    head.Note            = this.txtNote.Text.Trim();
                    head.LogisticCompID  = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        head.AutoGenerateDetail(session);
                        session.Commit();
                        created = true;
                        //this.txtAction.Value = "edit";
                        //this.txtId.Value = head.OrderNumber;
                        //this.showInfo(session, head);
                        //this.setView(head);
                        //WebUtil.ShowMsg(this, string.Format("交接单{0}创建成功", head.OrderNumber));
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }
                }
                if (created)
                {
                    this.Response.Redirect("InterchangeLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                }

                head                = ICHead.Retrieve(session, this.OrderNumber);
                head.Note           = this.txtNote.Text.Trim();
                head.LogisticCompID = Magic.Framework.Utils.Cast.Int(this.drpLogistic.SelectedValue);
                head.LogisticUser   = this.txtLogisticsUser.Text.Trim();
                head.Update(session, "Note", "LogisticCompID", "LogisticUser", "BoxNum");
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
Example #41
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                DateTime fromDate = Cast.DateTime(this.txtDateFrom.Text.Trim(), new DateTime(1900, 1, 1));
                DateTime toDate   = Cast.DateTime(this.txtDateTo.Text.Trim(), new DateTime(1900, 1, 1));
                if (fromDate == new DateTime(1900, 1, 1))
                {
                    WebUtil.ShowError(this, "请输入开始时间");
                    return;
                }
                int     logisId = Cast.Int(this.drpLogis.SelectedValue, 0);
                int     count   = 0;
                DataSet ds      = Report.SaleReturn(session, fromDate, toDate, this.drpReturnType.SelectedValue
                                                    , logisId, this.txtRTNumber.Text, this.txtSNNumber.Text, this.txtSONumber.Text
                                                    , -1, 0, false, ref count);

                //下载到Excel
                string fileName = DownloadUtil.DownloadXls("Sale_Return_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_RTN_SUM",
                                                           new List <DownloadFormat>()
                {
                    new DownloadFormat(DataType.Text, "退货日期", "inner_date"),
                    new DownloadFormat(DataType.Text, "退货单号", "RTNumber"),
                    new DownloadFormat(DataType.NumberText, "发货单号", "SNNumber"),
                    new DownloadFormat(DataType.Text, "订单号", "SONumber"),
                    new DownloadFormat(DataType.Text, "运单号", "ShippingNumber"),
                    new DownloadFormat(DataType.Text, "退货类型", "OrderType"),
                    new DownloadFormat(DataType.Text, "物流公司", "LogisName"),
                    new DownloadFormat(DataType.Number, "销售收入", "SaleAmt"),
                    new DownloadFormat(DataType.Number, "发送费", "TransportAmt"),
                    new DownloadFormat(DataType.Number, "包装费", "PackageAmt"),
                    new DownloadFormat(DataType.Number, "礼券抵扣", "CouponsAmt"),
                    new DownloadFormat(DataType.Number, "销售折扣", "DiscountAmt"),
                    new DownloadFormat(DataType.Number, "退款合计", "ReturnAmt"),
                    new DownloadFormat(DataType.Number, "退回礼金", "EMoneyAmt"),
                    new DownloadFormat(DataType.Number, "退回帐户", "AccountReceivable"),
                    new DownloadFormat(DataType.Number, "POS机收款", "Posreceivable"),
                    new DownloadFormat(DataType.Number, "物流应收款", "LogisReceivable")
                }, ds);
                this.frameDownload.Attributes["src"] = fileName;
                WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
            }
            catch (Exception er)
            {
                WebUtil.ShowError(this, er);
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Save") return;

        using (ISession session = new Session())
        {
            try
            {
                IList<WHTransferLine> lines = new List<WHTransferLine>();
                WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    TextBox text = item.FindControl("txtMoveQty") as TextBox;
                    decimal qty = Cast.Decimal(text.Text, 0M);
                    if (qty <= 0M) continue;

                    WHTransferLine line = new WHTransferLine();
                    line.MoveQty = qty;
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    line.FromStockID = Cast.Int(chk.Value);
                    HtmlInputText input = item.FindControl("hidTransferQty") as HtmlInputText;
                    qty = Cast.Decimal(input.Value, 0M);
                    if (line.MoveQty > qty)
                    {
                        WebUtil.ShowError(this, "�ƿ�������С�ڻ���ڿ��ƿ���");
                        return;
                    }
                    DropDownList drp = item.FindControl("drpToArea") as DropDownList;
                    line.ToArea = drp.SelectedValue;
                    text = item.FindControl("txtToSection") as TextBox;
                    line.ToSection = text.Text.Trim();
                    lines.Add(line);
                }
                if (lines.Count <= 0)
                {
                    log.Debug("Save - �ƿ���ϸ: û����д�ƿ�������δ�����ϸ");
                    return;
                }

                session.BeginTransaction();
                head.AddLines(session, lines);
                session.Commit();

                log.DebugFormat("Save - �ƿ���ϸ: �ܹ������{0}���ƿ���ϸ", lines.Count);
                WebUtil.ShowMsg(this, "�Ѿ������ƿ���ϸ");
                this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
            }
            catch (Exception er)
            {
                log.Error("Save - �ƿ���ϸ: ", er);
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
Example #43
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_PRD_IN;
                    head.Status        = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser   = 0;
                    head.ApproveTime   = new DateTime(1900, 1, 1);
                    head.CreateUser    = SecuritySession.CurrentUser.UserId;
                    head.CreateTime    = DateTime.Now;
                    head.Note          = this.txtNote.Text.Trim();
                    head.LocationCode  = this.drpLocation.SelectedValue;
                    head.RefOrdNum     = this.txtRefOrdNum.Text.Trim().ToUpper();
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        head.AddPrdOutDetail2ThisOrder(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    return;
                }

                head              = StockInHead.Retrieve(session, this.OrderNumber);
                head.Note         = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.RefOrdNum    = this.txtRefOrdNum.Text.Trim().ToUpper();
                head.Update(session, "Note", "LocationCode", "RefOrdNum");
                //没有明细时,才考虑将库存领用明细添加进来
                if (session.CreateEntityQuery <StockInLine>()
                    .Where(Magic.Framework.ORM.Query.Exp.Eq("OrderNumber", head.OrderNumber))
                    .Count() <= 0)
                {
                    head.AddPrdOutDetail2ThisOrder(session);
                }
                this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
Example #44
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                WHTransferHead head = null;
                if (this.IsNew)
                {
                    head               = new WHTransferHead();
                    head.OrderNumber   = ERPUtil.NextOrderNumber(WHTransferHead.ORDER_TYPE_NORMAL);
                    head.Note          = this.txtNote.Text.Trim();
                    head.FromLocation  = this.drpFromLocation.SelectedValue;
                    head.ToLocation    = this.drpToLocation.SelectedValue;
                    head.Status        = WHTransferStatus.New;
                    head.OrderTypeCode = WHTransferHead.ORDER_TYPE_NORMAL;
                    head.CreateTime    = DateTime.Now;
                    head.CreateUser    = SecuritySession.CurrentUser.UserId;

                    head.Create(session);
                    log.DebugFormat("Create - 移库单: {0}", head.OrderNumber);

                    System.Text.StringBuilder url = new System.Text.StringBuilder();
                    url.Append("TransferNewLine.aspx?ordNum=").Append(head.OrderNumber);
                    url.Append("&return=");
                    //保存后跳转到添加明细页面
                    //下面的返回url设置用途:
                    //1. 从添加明细页面点击返回按钮,将跳转到明细维护界面
                    //2. 明细维护界面再点击返回按钮,跳转到移库单主档维护页面,并且保留下从移库单主档维护页面进入新增页面时的查询条件
                    url.Append(WebUtil.escape("TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"))));
                    if (log.IsDebugEnabled)
                    {
                        log.DebugFormat("Redirect - to添加移库明细: url={0}", url.ToString());
                        log.DebugFormat("返回移库明细页地址: url={0}", "TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    }
                    this.Response.Redirect(url.ToString());
                }

                head = WHTransferHead.Retrieve(session, this.OrderNumber);
                if (head.Status != WHTransferStatus.New)
                {
                    log.WarnFormat("Warn - 保存移库单: 移库单{0}状态为{1},无法保存", head.OrderNumber, head.Status.ToString());
                    WebUtil.ShowMsg(this, "只有状态为新建的移库单可以修改保存!");
                    return;
                }
                head.Note         = this.txtNote.Text.Trim();
                head.FromLocation = this.drpFromLocation.SelectedValue;
                head.ToLocation   = this.drpToLocation.SelectedValue;
                head.Update(session, "Note", "FromLocation", "ToLocation");
                log.DebugFormat("Update - 移库单: {0}", head.OrderNumber);
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
    //MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one.
    protected void MagicItemCommand(object sender,MagicItemEventArgs e)
    {
        try
        {
            Repeater rpt = null;
            MagicPager pager = null;
            bool isGroup = false; ;
            if (e.CommandName == "DeleteUser")
            { // do delete
                rpt = this.rptSubscribeUser;
                pager = this.magicPagerUser;
                isGroup = false;
              }
            else if (e.CommandName == "DeleteGroup")
            {
                rpt = this.rptSubscribeGroup;
                pager = this.magicPagerGroup;
                isGroup = true;
            }
            if (rpt != null)
            {
                using (_session = new Session())
                {
                    foreach (RepeaterItem item in rpt.Items)
                    {
                        HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                        if (chk != null && chk.Checked)
                        {
                            int subscriberId = Cast.Int(chk.Attributes["subscriberId"]);

                            MsgSubscriber.Delete(_session, subscriberId);
                        }
                    }

                    QueryAndBindData(rpt,pager, isGroup,1, pager.PageSize, true);

                }
            }
          }

           catch(UnauthorizedException ex)
        {
            WebUtil.ShowMsg(this,ex.Message,"警告");
        }
        catch(ApplicationException ex)
        {
            WebUtil.ShowMsg(this,ex.Message,"提示");
        }
        catch(Exception ex)
        {
            logger.Info("删除MsgSubscriber", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                WHTransferHead head = null;
                if (this.IsNew)
                {
                    head = new WHTransferHead();
                    head.OrderNumber = ERPUtil.NextOrderNumber(WHTransferHead.ORDER_TYPE_NORMAL);
                    head.Note = this.txtNote.Text.Trim();
                    head.FromLocation = this.drpFromLocation.SelectedValue;
                    head.ToLocation = this.drpToLocation.SelectedValue;
                    head.Status = WHTransferStatus.New;
                    head.OrderTypeCode = WHTransferHead.ORDER_TYPE_NORMAL;
                    head.CreateTime = DateTime.Now;
                    head.CreateUser = SecuritySession.CurrentUser.UserId;

                    head.Create(session);
                    log.DebugFormat("Create - 移库单: {0}", head.OrderNumber);

                    System.Text.StringBuilder url = new System.Text.StringBuilder();
                    url.Append("TransferNewLine.aspx?ordNum=").Append(head.OrderNumber);
                    url.Append("&return=");
                    //保存后跳转到添加明细页面
                    //下面的返回url设置用途:
                    //1. 从添加明细页面点击返回按钮,将跳转到明细维护界面
                    //2. 明细维护界面再点击返回按钮,跳转到移库单主档维护页面,并且保留下从移库单主档维护页面进入新增页面时的查询条件
                    url.Append(WebUtil.escape("TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"))));
                    if (log.IsDebugEnabled)
                    {
                        log.DebugFormat("Redirect - to添加移库明细: url={0}", url.ToString());
                        log.DebugFormat("返回移库明细页地址: url={0}", "TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    }
                    this.Response.Redirect(url.ToString());
                }

                head = WHTransferHead.Retrieve(session, this.OrderNumber);
                if (head.Status != WHTransferStatus.New)
                {
                    log.WarnFormat("Warn - 保存移库单: 移库单{0}状态为{1},无法保存", head.OrderNumber, head.Status.ToString());
                    WebUtil.ShowMsg(this, "只有状态为新建的移库单可以修改保存!");
                    return;
                }
                head.Note = this.txtNote.Text.Trim();
                head.FromLocation = this.drpFromLocation.SelectedValue;
                head.ToLocation = this.drpToLocation.SelectedValue;
                head.Update(session, "Note", "FromLocation", "ToLocation");
                log.DebugFormat("Update - 移库单: {0}", head.OrderNumber);
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
Example #47
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            int      periodId    = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId <= 0)
            {
                return;
            }

            int     count    = 0;
            DataSet ds       = Report.StockBalanceDetail(session, periodId, Cast.Int(this.drpItemCat.SelectedValue), this.txtItemCode.Text, this.txtItemName.Text, this.txtColor.Text, this.txtSize.Text, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Inv_Balance_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls"
                                                        , "RPT_INV_DTL", Server.MapPath("/Template/RPT_Stock_Balance_Detail_Download.xls"), null, 3
                                                        , new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "", "CatName"),
                new DownloadFormat(DataType.Text, "", "ItemCode"),
                new DownloadFormat(DataType.Text, "", "ItemName"),
                new DownloadFormat(DataType.Text, "", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "", "SizeCode"),
                new DownloadFormat(DataType.Number, "", "BeginQty"),
                new DownloadFormat(DataType.Number, "", "BeginAmt"),
                new DownloadFormat(DataType.Number, "", "PurQty"),
                new DownloadFormat(DataType.Number, "", "PurAmt"),
                new DownloadFormat(DataType.Number, "", "PurReturnQty"),
                new DownloadFormat(DataType.Number, "", "PurReturnAmt"),
                new DownloadFormat(DataType.Number, "", "SaleQty"),
                new DownloadFormat(DataType.Number, "", "SaleAmt"),
                new DownloadFormat(DataType.Number, "", "SaleReturnQty"),
                new DownloadFormat(DataType.Number, "", "SaleReturnAmt"),
                new DownloadFormat(DataType.Number, "", "UsedQty"),
                new DownloadFormat(DataType.Number, "", "UsedAmt"),
                new DownloadFormat(DataType.Number, "", "OtherInQty"),
                new DownloadFormat(DataType.Number, "", "OtherInAmt"),
                new DownloadFormat(DataType.Number, "", "CheckQty"),
                new DownloadFormat(DataType.Number, "", "CheckAmt"),
                new DownloadFormat(DataType.Number, "", "AdjustQty"),
                new DownloadFormat(DataType.Number, "", "AdjustAmt"),
                new DownloadFormat(DataType.Number, "", "ScrapQty"),
                new DownloadFormat(DataType.Number, "", "ScrapAmt"),
                new DownloadFormat(DataType.Number, "", "DiffAmt"),
                new DownloadFormat(DataType.Number, "", "EndQty"),
                new DownloadFormat(DataType.Number, "", "EndAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                POReturnHead head = null;
                if (this.IsNew)
                {
                    head = new POReturnHead();
                    head.Status = POReturnStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.Note = this.txtNote.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    head.VendorID = Cast.Int(this.drpVendor.SelectedValue);
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                        return;
                    }

                    this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    return;
                }

                head = POReturnHead.Retrieve(session, this.OrderNumber);
                try
                {
                    session.BeginTransaction();
                    head.Update(session, Cast.Int(this.drpVendor.SelectedValue), this.drpLocation.SelectedValue, this.txtNote.Text.Trim());
                    session.Commit();
                }
                catch (Exception er)
                {
                    session.Rollback();
                    WebUtil.ShowError(this, er);
                    return;
                }
                this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                POReturnHead head = null;
                if (this.IsNew)
                {
                    head               = new POReturnHead();
                    head.Status        = POReturnStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser   = 0;
                    head.ApproveTime   = new DateTime(1900, 1, 1);
                    head.CreateUser    = SecuritySession.CurrentUser.UserId;
                    head.CreateTime    = DateTime.Now;
                    head.Note          = this.txtNote.Text.Trim();
                    head.LocationCode  = this.drpLocation.SelectedValue;
                    head.VendorID      = Cast.Int(this.drpVendor.SelectedValue);
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                        return;
                    }

                    this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    return;
                }

                head = POReturnHead.Retrieve(session, this.OrderNumber);
                try
                {
                    session.BeginTransaction();
                    head.Update(session, Cast.Int(this.drpVendor.SelectedValue), this.drpLocation.SelectedValue, this.txtNote.Text.Trim());
                    session.Commit();
                }
                catch (Exception er)
                {
                    session.Rollback();
                    WebUtil.ShowError(this, er);
                    return;
                }
                this.Response.Redirect("POReturnLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
Example #50
0
    //MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one.
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        try
        {
            Repeater   rpt     = null;
            MagicPager pager   = null;
            bool       isGroup = false;;
            if (e.CommandName == "DeleteUser")
            {             // do delete
                rpt     = this.rptSubscribeUser;
                pager   = this.magicPagerUser;
                isGroup = false;
            }
            else if (e.CommandName == "DeleteGroup")
            {
                rpt     = this.rptSubscribeGroup;
                pager   = this.magicPagerGroup;
                isGroup = true;
            }
            if (rpt != null)
            {
                using (_session = new Session())
                {
                    foreach (RepeaterItem item in rpt.Items)
                    {
                        HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                        if (chk != null && chk.Checked)
                        {
                            int subscriberId = Cast.Int(chk.Attributes["subscriberId"]);

                            MsgSubscriber.Delete(_session, subscriberId);
                        }
                    }

                    QueryAndBindData(rpt, pager, isGroup, 1, pager.PageSize, true);
                }
            }
        }

        catch (UnauthorizedException ex)
        {
            WebUtil.ShowMsg(this, ex.Message, "警告");
        }
        catch (ApplicationException ex)
        {
            WebUtil.ShowMsg(this, ex.Message, "提示");
        }
        catch (Exception ex)
        {
            logger.Info("删除MsgSubscriber", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
Example #51
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Save")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                IList <StockInLine> lines = new List <StockInLine>();
                StockInHead         head  = StockInHead.Retrieve(session, this.OrderNumber);
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    TextBox text = item.FindControl("txtQty") as TextBox;
                    decimal qty  = Cast.Decimal(text.Text, 0M);
                    if (qty <= 0M)
                    {
                        continue;
                    }

                    HtmlInputCheckBox chk  = item.FindControl("checkbox") as HtmlInputCheckBox;
                    StockInLine       line = new StockInLine();
                    line.OrderNumber   = this.OrderNumber;
                    line.StockDetailID = Cast.Int(chk.Value);
                    line.LineNumber    = Cast.String(chk.Attributes["line"]);
                    line.Quantity      = qty;
                    line.Price         = 0M;
                    lines.Add(line);
                }
                if (lines.Count <= 0)
                {
                    log.Debug("Save - assist item req line: no lines need to be saved");
                    return;
                }

                session.BeginTransaction();
                head.CreateOrUpdateLines(session, lines);
                session.Commit();

                log.DebugFormat("Save - assist item req line: {0} lines were created or updated", lines.Count);
                WebUtil.ShowMsg(this, "辅料领用明细已经保存");
                this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
            }
            catch (Exception er)
            {
                log.Error("Save - to add assist item req line: ", er);
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_PRD_IN;
                    head.Status = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.Note = this.txtNote.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        head.AddPrdOutDetail2ThisOrder(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    return;
                }

                head = StockInHead.Retrieve(session, this.OrderNumber);
                head.Note = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
                head.Update(session, "Note", "LocationCode", "RefOrdNum");
                //没有明细时,才考虑将库存领用明细添加进来
                if (session.CreateEntityQuery<StockInLine>()
                    .Where(Magic.Framework.ORM.Query.Exp.Eq("OrderNumber", head.OrderNumber))
                    .Count() <= 0)
                    head.AddPrdOutDetail2ThisOrder(session);
                this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download") return;

        using (ISession session = new Session())
        {
            try
            {
                DateTime fromDate = Cast.DateTime(this.txtDateFrom.Text.Trim(), new DateTime(1900, 1, 1));
                DateTime toDate = Cast.DateTime(this.txtDateTo.Text.Trim(), new DateTime(1900, 1, 1));
                if (fromDate == new DateTime(1900, 1, 1))
                {
                    WebUtil.ShowError(this, "�����뿪ʼʱ��");
                    return;
                }
                int logisId = Cast.Int(this.drpLogis.SelectedValue, 0);
                int count = 0;
                DataSet ds = Report.SaleReturn(session, fromDate, toDate, this.drpReturnType.SelectedValue
                    , logisId, this.txtRTNumber.Text, this.txtSNNumber.Text, this.txtSONumber.Text
                    , -1, 0, false, ref count);

                //���ص�Excel
                string fileName = DownloadUtil.DownloadXls("Sale_Return_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_RTN_SUM",
                    new List<DownloadFormat>()
                    {
                        new DownloadFormat(DataType.Text, "�˻�����", "inner_date"),
                        new DownloadFormat(DataType.Text, "�˻�����", "RTNumber"),
                        new DownloadFormat(DataType.NumberText, "��������", "SNNumber"),
                        new DownloadFormat(DataType.Text, "������", "SONumber"),
                        new DownloadFormat(DataType.Text, "�˵���", "ShippingNumber"),
                        new DownloadFormat(DataType.Text, "�˻�����", "OrderType"),
                        new DownloadFormat(DataType.Text, "������˾", "LogisName"),
                        new DownloadFormat(DataType.Number, "��������", "SaleAmt"),
                        new DownloadFormat(DataType.Number, "���ͷ�", "TransportAmt"),
                        new DownloadFormat(DataType.Number, "��װ��", "PackageAmt"),
                        new DownloadFormat(DataType.Number, "��ȯ�ֿ�", "CouponsAmt"),
                        new DownloadFormat(DataType.Number, "�����ۿ�", "DiscountAmt"),
                        new DownloadFormat(DataType.Number, "�˿�ϼ�", "ReturnAmt"),
                        new DownloadFormat(DataType.Number, "�˻����", "EMoneyAmt"),
                        new DownloadFormat(DataType.Number, "�˻��ʻ�", "AccountReceivable"),
                        new DownloadFormat(DataType.Number, "POS���տ�", "Posreceivable"),
                        new DownloadFormat(DataType.Number, "����Ӧ�տ�", "LogisReceivable")
                    }, ds);
                this.frameDownload.Attributes["src"] = fileName;
                WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
            }
            catch (Exception er)
            {
                WebUtil.ShowError(this, er);
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate   = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }

            int     count = 0;
            DataSet ds    = Report.MbrAccountDetail(session, startDate, endDate
                                                    , Cast.Int(this.drpFlush.SelectedValue), Cast.Int(this.drpPayment.SelectedValue)
                                                    , this.txtOrder.Text, this.txtMbrID.Text, this.txtMbrName.Text, this.txtUser.Text
                                                    , -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Member_Account_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_MBR_ACC_",
                                                       new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Date, "日期", "FlushDate"),
                new DownloadFormat(DataType.Text, "变动原因", "FlushType"),
                new DownloadFormat(DataType.Text, "支付方式", "PaymentType"),
                new DownloadFormat(DataType.NumberText, "会员号", "MbrNum"),
                new DownloadFormat(DataType.Text, "姓名", "MbrName"),
                new DownloadFormat(DataType.NumberText, "凭证号", "OrderNumber"),
                new DownloadFormat(DataType.Number, "变动金额", "FlushAmt"),
                new DownloadFormat(DataType.Text, "操作人", "UserName"),
                new DownloadFormat(DataType.Text, "操作备注", "comments")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
            WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            bool saved = false;
            using (ISession session = new Session())
            {
                ExcelTemplate template;
                if (this.IsAddNew())
                {
                    if (!this.FileUpload1.HasFile)
                    {
                        WebUtil.ShowError(this, "请选择模板文件");
                        return;
                    }
                    if (!this.FileUpload1.FileName.EndsWith(".xls"))
                    {
                        WebUtil.ShowError(this, "请选择有效的Excel文件");
                        return;
                    }
                    string fileName = DateTime.Now.ToString("SN_yyMMdd_HHmmss") + ".xls";
                    string virtualPath = "/Template/" + fileName;
                    this.FileUpload1.SaveAs(Server.MapPath(virtualPath));
                    template = new ExcelTemplate();
                    template.TemplateName = this.txtName.Text.Trim();
                    template.Status = ExcelTemplateStatus.Enable;
                    template.FileVirtualPath = virtualPath;
                    template.Create(session);
                    saved = true;
                }
                else
                {
                    template = ExcelTemplate.Retrieve(session, Cast.Int(this.txtId.Value));
                    if (template == null) return;

                    if (this.FileUpload1.HasFile)
                        //保存文件
                        this.FileUpload1.SaveAs(Server.MapPath(template.FileVirtualPath));
                    template.TemplateName = this.txtName.Text.Trim();
                    if (this.drpStatus.SelectedValue == ((int)ExcelTemplateStatus.Enable).ToString())
                        template.Status = ExcelTemplateStatus.Enable;
                    else
                        template.Status = ExcelTemplateStatus.Disable;
                    template.Update(session, "TemplateName", "Status");
                    saved = true;
                }
            }
            if (saved)
                this.Response.Redirect("ExcelTemplateManager.aspx");
        }
    }
    //MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one.
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        try
        {
            if (e.CommandName == "Delete")
            { // do delete
                using (ISession session = new Session())
                {
                    foreach (RepeaterItem item in this.rptMessage.Items)
                    {
                        HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                        if (chk != null && chk.Checked)
                        {
                            int messageId = Cast.Int(chk.Attributes["messageId"]);

                            Message.Delete(session, messageId);
                        }
                    }

                    QueryAndBindData(1, this.magicPagerMain.PageSize, true);

                }
            }
            else if (e.CommandName == "SendNewMessage")
            {
                using (ISession session = new Session())
                {

                    Message.SendNewMessage(session);

                    WebUtil.ShowMsg(this, "已经检查新消息,并发送完毕!");
                    QueryAndBindData(1, this.magicPagerMain.PageSize, true);

                }
            }
        }
        catch (UnauthorizedException ex)
        {
            WebUtil.ShowMsg(this, ex.Message, "警告");
        }
        catch (ApplicationException ex)
        {
            WebUtil.ShowMsg(this, ex.Message, "提示");
        }
        catch (Exception ex)
        {
            logger.Info("MessageEdit.aspx", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        using (ISession session = new Session())
        {
            try
            {
                session.BeginTransaction();
                foreach (RepeaterItem item in this.rptPO.Items)
                {
                    HiddenField hidsku = item.FindControl("hidsku") as HiddenField;
                    TextBox     text   = item.FindControl("txtQty") as TextBox;
                    int         skuId  = Cast.Int(hidsku.Value);
                    decimal     qty    = Cast.Decimal(text.Text);
                    if (skuId <= 0)
                    {
                        continue;
                    }

                    PendingReceipt pr = PendingReceipt.Retrieve(session, skuId);
                    if (pr == null)
                    {
                        if (qty <= 0M)
                        {
                            continue;
                        }
                        pr = new PendingReceipt()
                        {
                            SKU_ID = skuId
                        };
                        pr.Qty = qty;
                        pr.Create(session);
                    }
                    else
                    {
                        pr.Qty = qty;
                        pr.Update(session);
                    }
                }

                session.Commit();
                WebUtil.ShowMsg(this, "保存成功");
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
Example #58
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate   = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }

            DataSet ds       = Report.SaleAmtSum(session, startDate, endDate);
            string  fileName = DownloadUtil.DownloadXls("Sale_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_AMT_SUM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "物流公司", "LogisName"),
                new DownloadFormat(DataType.Number, "销售收入", "SaleAmt"),
                new DownloadFormat(DataType.Number, "发送费", "TransportAmt"),
                new DownloadFormat(DataType.Number, "包装费", "PackageAmt"),
                new DownloadFormat(DataType.Number, "礼券抵扣", "CouponsAmt"),
                new DownloadFormat(DataType.Number, "销售折扣", "DiscountAmt"),
                new DownloadFormat(DataType.Number, "订单金额合计", "OrderAmt"),
                new DownloadFormat(DataType.Number, "礼金支付", "EMoneyAmt"),
                new DownloadFormat(DataType.Number, "帐户支付", "AccountReceivable"),
                new DownloadFormat(DataType.Number, "POS机收款", "PosReceivable"),
                new DownloadFormat(DataType.Number, "物流应收款", "LogisReceivable")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_ASSIST_IN;
                    head.Status        = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser   = 0;
                    head.ApproveTime   = new DateTime(1900, 1, 1);
                    head.CreateUser    = SecuritySession.CurrentUser.UserId;
                    head.CreateTime    = DateTime.Now;
                    head.Note          = this.txtNote.Text.Trim();
                    head.LocationCode  = this.drpLocation.SelectedValue;
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        session.Commit();

                        this.txtAction.Value = "edit";
                        this.txtId.Value     = head.OrderNumber;
                        this.showInfo(session, head);
                        this.setView(head);
                        WebUtil.ShowMsg(this, string.Format("入库单{0}创建成功", head.OrderNumber));
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    return;
                }

                head              = StockInHead.Retrieve(session, this.OrderNumber);
                head.Note         = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.Update(session, "Note", "LocationCode");
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
Example #60
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                //获取数据
                DateTime fromDate = Cast.DateTime(this.txtDateFrom.Text.Trim(), new DateTime(1900, 1, 1));
                DateTime toDate   = Cast.DateTime(this.txtDateTo.Text.Trim(), new DateTime(1900, 1, 1));
                if (fromDate == new DateTime(1900, 1, 1))
                {
                    WebUtil.ShowError(this, "请输入开始时间");
                    return;
                }
                DataSet ds = Report.PurchaseReceiveDetail(session, Cast.Int(this.drpVendor.SelectedValue)
                                                          , this.txtRcvNumber.Text, this.txtPONumber.Text, fromDate, toDate);

                //下载到Excel
                string fileName = DownloadUtil.DownloadXls("RCV_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_RCV_DTL",
                                                           new List <DownloadFormat>()
                {
                    new DownloadFormat(DataType.Text, "收货单", "RCVNumber"),
                    new DownloadFormat(DataType.Text, "采购单", "PONumber"),
                    new DownloadFormat(DataType.NumberText, "行号", "RCVLine"),
                    new DownloadFormat(DataType.NumberText, "PO行号", "POLine"),
                    new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                    new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                    new DownloadFormat(DataType.Text, "商品名称", "ItemName"),
                    new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                    new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                    new DownloadFormat(DataType.Number, "收货数量", "RCVQty"),
                    new DownloadFormat(DataType.Number, "单价", "Price"),
                    new DownloadFormat(DataType.Number, "金额", "RCVAmt")
                }, ds);
                this.frameDownload.Attributes["src"] = fileName;
                WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
            }
            catch (Exception er)
            {
                WebUtil.ShowError(this, er);
            }
        }
    }