protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }

        TextBox txt = e.Item.FindControl("txtQty") as TextBox;

        txt.Text = RenderUtil.FormatNumber(drv["CurrentQty"], "#0.##");
        if (this._head.Status != INVCheckStatus.Confirm)
        {
            WebUtil.DisableControl(txt);
        }

        Label lbl = e.Item.FindControl("lblBefQty") as Label;

        if (this._head.CheckType == INVCheckType.Implicit && (this._head.Status == INVCheckStatus.Confirm))
        {
            lbl.Text = "-";
        }
        else
        {
            lbl.Text = RenderUtil.FormatNumber(drv["BeforeQty"], "#0.##");
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string snNumber = WebUtil.Param("ordNum");

        if (string.IsNullOrEmpty(snNumber))
        {
            return;
        }

        ExcelTemplate template             = null;
        IDictionary <string, string> items = new Dictionary <string, string>();

        #region 获取数据
        //所有要替换的标签先初始化为空值
        items["$RecipientName$"]    = "";
        items["$RecipientCity$"]    = "";
        items["$RecipientArea$"]    = "";
        items["$RecipientAddress$"] = "";
        items["$RecipientPhone$"]   = "";
        items["$RecipientMobile$"]  = "";
        items["$RecipientZipCode$"] = "";
        items["$AgencyAmt$"]        = "";
        items["$PaidAmt$"]          = "";
        items["$Remark$"]           = "";
        items["$Weight$"]           = "";
        items["$PackageCount$"]     = "";
        using (ISession session = new Session())
        {
            CRMSN sn = CRMSN.Retrieve(session, snNumber);
            if (sn == null)
            {
                return;
            }
            Member mbr = Member.Retrieve(session, sn.MemberID);
            template = ExcelTemplate.Retrieve(session, WebUtil.ParamInt("tid", 0));
            if (template == null)
            {
                return;
            }

            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("(<br.*?>)|(</br>)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            items["$RecipientName$"]    = sn.Contact;
            items["$RecipientCity$"]    = sn.City;
            items["$RecipientArea$"]    = Cast.String(sn.Province) + " " + Cast.String(sn.City); //省市区,缺少区
            items["$RecipientAddress$"] = sn.Address;
            items["$RecipientCompany$"] = "";
            items["$RecipientPhone$"]   = "'" + sn.Phone;
            items["$RecipientMobile$"]  = "'" + (string.IsNullOrEmpty(sn.Mobile) || sn.Mobile.Trim().Length <= 0 ? mbr.Mobile : sn.Mobile);
            items["$RecipientZipCode$"] = "'" + sn.PostCode;
            items["$AgencyAmt$"]        = RenderUtil.FormatNumber(sn.AgentAmt, "#0.##", "");
            items["$PaidAmt$"]          = "'" + RenderUtil.FormatNumber(sn.PaidAmt, "#0.##", "");
            items["$Remark$"]           = "'" + regex.Replace(Cast.String(sn.Remark), "\r\n");
            items["$Weight$"]           = sn.PackageWeight <= 0 ? "" : ("'" + sn.PackageWeight.ToString("#0.##"));
            items["$PackageCount$"]     = "'" + RenderUtil.FormatNumber(sn.PackageCount, "#0.##", "");
        }
        #endregion

        this.Response.Redirect(DownloadUtil.DownloadXls("SN_" + snNumber + ".xls", "SN", Server.MapPath(template.FileVirtualPath), items));
    }
Exemple #3
0
    protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }

        DropDownList drp = e.Item.FindControl("drpArea") as DropDownList;

        if (this.GetAreas() != null)
        {
            drp.Items.Clear();
            drp.Items.Add(new ListItem("", ""));
            foreach (WHArea area in this.GetAreas())
            {
                drp.Items.Add(new ListItem(area.AreaCode, area.AreaCode));
            }
            string selectedArea = Cast.String(drv["AreaCode"]).Trim();
            if (!string.IsNullOrEmpty(selectedArea))
            {
                drp.SelectedValue = selectedArea;
            }
        }
        if (this._head != null && this._head.Status != StockInStatus.New)
        {
            WebUtil.DisableControl(drp);
        }

        TextBox txt;

        txt      = e.Item.FindControl("txtSection") as TextBox;
        txt.Text = Cast.String(drv["SectionCode"]);
        if (this._head != null && this._head.Status != StockInStatus.New)
        {
            WebUtil.DisableControl(txt);
        }
        txt      = e.Item.FindControl("txtQualifiedQty") as TextBox;
        txt.Text = RenderUtil.FormatNumber(drv["Quantity"], "#0.##");
        if (this._head != null && this._head.Status != StockInStatus.New)
        {
            WebUtil.DisableControl(txt);
            HtmlInputCheckBox chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox;
            chk.Visible = false;
        }
        txt      = e.Item.FindControl("txtPrice") as TextBox;
        txt.Text = RenderUtil.FormatNumber(drv["Price"], "#0.##");
        if (this._head != null && this._head.Status != StockInStatus.New)
        {
            WebUtil.DisableControl(txt);
        }
    }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int skuid = WebUtil.ParamInt("sku", 0);
         if (skuid <= 0)
         {
             this.divMsg.InnerText = "无效的SKU";
             return;
         }
         using (ISession session = new Session())
         {
             ItemSpec spec = ItemSpec.Retrieve(session, skuid);
             if (spec == null)
             {
                 this.divMsg.InnerText = "SKU " + skuid.ToString() + "不存在";
                 return;
             }
             //显示sku信息
             this.lblItemCode.Text = spec.ItemCode;
             this.lblSize.Text     = spec.SizeCode;
             ItemMaster master = ItemMaster.Retrieve(session, spec.ItemCode);
             this.lblItemName.Text = master == null ? "" : master.ItemName;
             ItemColor color = ItemColor.Retrieve(session, spec.ColorCode);
             this.lblColor.Text  = spec.ColorCode + " " + (color == null ? "" : color.ColorText);
             this.lblOVSQty.Text = spec.EnableOS ? RenderUtil.FormatNumber(spec.OSQty, "#0.##", "0") : "0";
             //现有库存
             StockSummary sto = StockSummary.Retrieve(session, skuid);
             this.lblStockQty.Text  = sto == null ? "0" : RenderUtil.FormatNumber(sto.StockQty, "#0.##");
             this.lblFrozenQty.Text = sto == null ? "0" : RenderUtil.FormatNumber(sto.FrozenQty, "#0.##");
             //在途采购记录
             IList <POLine> lines = POHead.PipelineInvQuery(session, skuid);
             this.repeater.DataSource = lines;
             this.repeater.DataBind();
             decimal pipelineStockQty = 0M;
             //计算汇总在途量
             foreach (POLine line in lines)
             {
                 pipelineStockQty += (line.PurchaseQty - line.ReceiveQty);
             }
             this.lblPipelineStock.Text = RenderUtil.FormatNumber(pipelineStockQty, "#0.##");
             if (lines.Count <= 0)
             {
                 this.divMsg.InnerText = "该SKU没有在途采购";
             }
             else
             {
                 this.divMsg.InnerText = "";
             }
         }
     }
 }
Exemple #5
0
    protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }

        Label lbl = e.Item.FindControl("lblFreeQty") as Label;

        lbl.Text = RenderUtil.FormatNumber(Cast.Decimal(drv["StockQty"]) - Cast.Decimal(drv["FrozenQty"]), "#0.##");
        TextBox txt = e.Item.FindControl("txtQty") as TextBox;

        txt.Text = RenderUtil.FormatNumber(drv["Qty"], "#0.##");
    }
Exemple #6
0
    protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }

        TextBox txt = e.Item.FindControl("txtPrice") as TextBox;

        txt.Text = RenderUtil.FormatNumber(drv["Price"], "#0.#0");
        if (this._head == null || this._head.Status != StockInStatus.Confirm)
        {
            WebUtil.DisableControl(txt);
        }
    }
    private void BindPOLine(ISession session, POHead poHead)
    {
        //显示POHead内容
        if (poHead != null)
        {
            this.LabOrderNumber.Text = poHead.OrderNumber;
            //供应商
            Vendor vendor = Vendor.Retrieve(session, poHead.VendorID);
            if (vendor != null)
            {
                this.LabVendorID.Text = vendor.ShortName;
            }
            //采购组
            this.LabPurchGroupCode.Text  = poHead.PurchGroupCode;
            this.LabTaxInclusiveAmt.Text = RenderUtil.FormatNumber(poHead.TaxInclusiveAmt, "#0.#0");
        }

        //POLine.SKUID=ItemSpec.SKUID  ItemSpec.ItemID=ItemMaster.ItemID
        //货号ItemMaster.ItemCode  商品名称ItemMaster.ItemName
        //颜色ItemSpec.ColorCode  尺码  ItemSpec.SizeCode
        ObjectQuery query = session.CreateObjectQuery(@"
select m.ItemCode as ItemCode,m.ItemName as ItemName,s.ColorCode as ColorCode,s.SizeCode as SizeCode
    ,p.LineNumber as LineNumber,p.LineStatus as LineStatus,p.PurchaseQty as PurchaseQty,p.PlanDate as PlanDate,p.Price as Price,p.OrderNumber as OrderNumber
    ,p.TaxInclusiveAmt as TaxInclusiveAmt,p.TaxValue as TaxValue,p.TaxAmt as TaxAmt,p.TaxID as TaxID
from POLine p
inner join ItemSpec s on p.SKUID=s.SKUID
inner join ItemMaster m on s.ItemID=m.ItemID
WHERE p.OrderNumber=?
order by p.LineNumber")
                            .Attach(typeof(POLine)).Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster))
                            .SetValue(0, this.OrderNumber, "p.OrderNumber");
        DataSet ds = query.DataSet();

        this.rptPL.DataSource = ds;
        this.rptPL.DataBind();

        int number = 0;

        foreach (DataRow row in ds.Tables[0].Rows)
        {
            number += Cast.Int(row["PurchaseQty"]);
        }
        this.lblTotalQty.Text = number.ToString();
    }
    protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView drv = e.Item.DataItem as DataRowView;

        if (drv == null)
        {
            return;
        }

        TextBox txt;

        txt      = e.Item.FindControl("txtQty") as TextBox;
        txt.Text = RenderUtil.FormatNumber(drv["Quantity"], "#0.##");
        if (this._head != null && this._head.Status != StockInStatus.New)
        {
            WebUtil.DisableControl(txt);
            HtmlInputCheckBox chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox;
            chk.Visible = false;
        }
    }
Exemple #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.cmdReturn1["Return"].NavigateUrl = this.cmdReturn2["Return"].NavigateUrl = WebUtil.Param("return");
            this.txtOrderNumber.Value             = this.OrderNumber;
            using (ISession session = new Session())
            {
                DataSet ds = session.CreateObjectQuery(@"
select l.LineNumber as LineNumber,l.RefOrderLine as RefOrderLine
    ,s.BarCode as BarCode,m.ItemCode as ItemCode,m.ItemName as ItemName,s.ColorCode as ColorCode,color.ColorText as ColorText,s.SizeCode as SizeCode
    ,l.RCVTotalQty as RCVTotalQty,l.QualifiedQty as QualifiedQty,l.Price as Price,0 as TotalAmt,l.TaxValue as TaxValue,0 as TaxAmt,0 as CostAmt
from RCVLine l
inner join ItemSpec s on l.SKUID=s.SKUID
inner join ItemMaster m on m.ItemID=s.ItemID
left join ItemColor color on color.ColorCode=s.ColorCode
where l.OrderNumber=?ordNum
order by l.LineNumber")
                             .Attach(typeof(RCVLine)).Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster)).Attach(typeof(ItemColor))
                             .SetValue("?ordNum", this.OrderNumber, "l.OrderNumber")
                             .DataSet();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    decimal qty = Cast.Decimal(row["QualifiedQty"]), price = Cast.Decimal(row["Price"]), tax = Cast.Decimal(row["TaxValue"]);
                    row["TotalAmt"]   = qty * price;
                    row["CostAmt"]    = qty * price / (1 + tax);
                    row["TaxAmt"]     = qty * price * (tax / (1 + tax));
                    this.TotalCost   += qty * price / (1 + tax);
                    this.TotalAmt    += qty * price;
                    this.TotalRcvQty += qty;
                }
                this.TotalTax                 = this.TotalAmt - this.TotalCost;
                this.lblTotalAmt.Text         = RenderUtil.FormatNumber(this.TotalAmt, "#,##0.#0", "0.00");
                this.lblTotalTax.Text         = RenderUtil.FormatNumber(this.TotalTax, "#,##0.#0", "0.00");
                this.lblTotalCost.Text        = RenderUtil.FormatNumber(this.TotalCost, "#,##0.#0", "0.00");
                this.lblRcvQtyTotal.Text      = RenderUtil.FormatNumber(this.TotalRcvQty, "#,##0.##", "0");
                this.repeatControl.DataSource = ds;
                this.repeatControl.DataBind();
            }
        }
    }
    private void QueryAndBindData(ISession session)
    {
        string      ordNum = WebUtil.Param("ordNum");
        ObjectQuery query  = session.CreateObjectQuery(@"
select s.BarCode as BarCode,m.ItemCode as ItemCode,m.ItemName as ItemName
    ,color.ColorText as ColorText,s.ColorCode as ColorCode,s.SizeCode as SizeCode,st.Name as SellTypeName
    ,case when tl.TransQty is null then line.Quantity else -tl.TransQty end as Quantity
    ,line.Price as Price,tl.AvgMoveCost as AvgMoveCost,0 as CostAmt
from CRMSN sn
inner join CRMSNLine line on sn.ID=line.SNID
left join WHTransLine tl on tl.RefOrderLine=line.ID
inner join ItemSpec s on s.SKUID=line.SKUID
inner join ItemMaster m on m.ItemID=s.ItemID
left join ItemColor color on color.ColorCode=s.ColorCode
left join CRMSaleType st on st.ID=line.SellType
where sn.OrderNumber=?ordnum and tl.RefOrderType='SD0'
order by line.ID")
                             .Attach(typeof(CRMSN)).Attach(typeof(CRMSNLine)).Attach(typeof(CRMSaleType)).Attach(typeof(WHTransLine))
                             .Attach(typeof(ItemMaster)).Attach(typeof(ItemSpec)).Attach(typeof(ItemColor))
                             .SetValue("?ordnum", ordNum, "sn.OrderNumber");

        DataSet ds = query.DataSet();

        ds.Tables[0].Columns.Add("Amt", typeof(decimal));
        decimal totalAmt = 0M, amt = 0M, totalCost = 0M, cost = 0M;

        foreach (DataRow row in ds.Tables[0].Rows)
        {
            amt            = Cast.Decimal(row["Quantity"]) * Cast.Decimal(row["Price"]);
            row["Amt"]     = amt;
            totalAmt      += amt;
            cost           = Cast.Decimal(row["AvgMoveCost"]) * Cast.Decimal(row["Quantity"]);
            row["CostAmt"] = cost;
            totalCost     += cost;
        }
        this.lblTotalAmt.Text         = RenderUtil.FormatNumber(totalAmt, "#,##0.#0");
        this.lblCostAmt.Text          = RenderUtil.FormatNumber(totalCost, "#,##0.#0");
        this.repeatControl.DataSource = ds;
        this.repeatControl.DataBind();
    }
Exemple #11
0
    private void QueryAndBindData(ISession 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;
        }

        if (periodId > 0)
        {
            DbSession  dbsession = session.DbSession as DbSession;
            IDbCommand cmd       = dbsession.CreateSqlStringCommand("select sum(begin_amt) as begin_amt,sum(end_amt) as end_amt from fi_rpt_cash_account_balance where pd_id=" + periodId.ToString());
            DataSet    ds        = dbsession.ExecuteDataSet(cmd);
            if (ds.Tables[0].Rows.Count > 0)
            {
                this.lblBegin.Text = RenderUtil.FormatNumber(Cast.Decimal(ds.Tables[0].Rows[0]["begin_amt"]), "#,##0.#0", "0.00");
                this.lblEnd.Text   = RenderUtil.FormatNumber(Cast.Decimal(ds.Tables[0].Rows[0]["end_amt"]), "#,##0.#0", "0.00");
            }
        }

        this.repeater.DataSource = Report.MbrAccountSum(session, startDate, endDate);
        this.repeater.DataBind();
        this.hidReturnUrl.Value = this.GetReturnUrl();
    }
Exemple #12
0
 public string CostAmt(object qty, object price, object tax)
 {
     return(RenderUtil.FormatNumber(Cast.Decimal(qty) * Cast.Decimal(price) / (1 + Cast.Decimal(tax)), "#0.#0"));
 }
Exemple #13
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Confirm" && e.CommandName != "Save")
        {
            return;
        }
        string snnumber = this.txtSNNumber.Text.Trim();

        if (snnumber.Length <= 0)
        {
            this.lblInfo.InnerText = "发货单号码为空";
            return;
        }

        using (ISession session = new Session())
        {
            CRMSN sn = CRMSN.Retrieve(session, snnumber);
            if (sn == null)
            {
                this.lblInfo.InnerText = "发货单" + snnumber + "不存在";
                return;
            }
            if (sn.Status != CRMSNStatus.Checked && sn.Status != CRMSNStatus.Packaged)
            {
                this.lblInfo.InnerText = "发货单" + (sn.Status == CRMSNStatus.Interchanged ? "已经完成交接" : "状态为" + sn.Status.ToString()) + ",不可以进行调整";
                return;
            }
            ICHead ic = ICHead.Query(session, sn.OrderNumber);
            if (ic != null)
            {
                this.lblInfo.InnerText = sn.OrderNumber + "已经被加入到交接单" + ic.OrderNumber + "中,请先从交接单中删除该发货单后再进行修改";
                return;
            }

            this.hidSnNumber.Value = snnumber;
            if (e.CommandName == "Confirm")
            {
                this.snView.SNNumber = sn.OrderNumber;
                if (sn.LogisticsID > 0)
                {
                    this.drpLogis.SelectedValue = sn.LogisticsID.ToString();
                }
                else
                {
                    this.drpLogis.SelectedValue = "0";
                }
                this.txtInvoice.Value        = sn.InvoiceNumber;
                this.txtPackageCount.Value   = sn.PackageCount.ToString();
                this.txtPackageWeight.Value  = RenderUtil.FormatNumber(sn.PackageWeight, "##0.#0");
                this.txtShippingNumber.Value = sn.ShippingNumber;
            }
            else if (e.CommandName == "Save")
            {
                if (Cast.Int(this.drpLogis.SelectedValue, 0) <= 0)
                {
                    this.lblInfo.InnerText = "请选择物流公司";
                    return;
                }
                sn.ShippingNumber = this.txtShippingNumber.Value.Trim();
                sn.InvoiceNumber  = this.txtInvoice.Value.Trim();
                sn.PackageWeight  = Cast.Decimal(this.txtPackageWeight.Value, sn.PackageWeight);
                sn.PackageCount   = Cast.Int(this.txtPackageCount.Value, sn.PackageCount);
                sn.LogisticsID    = Cast.Int(this.drpLogis.SelectedValue, 0);
                sn.Update(session, "ShippingNumber", "InvoiceNumber", "PackageWeight", "PackageCount", "LogisticsID");
                this.lblInfo.InnerText       = "发货单" + sn.OrderNumber + "包装信息修改成功";
                this.txtSNNumber.Text        = "";
                this.snView.SNNumber         = "";
                this.txtInvoice.Value        = "";
                this.txtPackageCount.Value   = "";
                this.txtPackageWeight.Value  = "";
                this.txtShippingNumber.Value = "";
            }
        }
    }
Exemple #14
0
 public string PipelineInvQty(object purQty, object rcvQty)
 {
     return(RenderUtil.FormatNumber(Cast.Decimal(purQty) - Cast.Decimal(rcvQty), "#0.##"));
 }