Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(User.Identity.Name))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
            }
            else
            {
                if (!IsPostBack && !IsCallback)
                {
                    var obec = ((BEParameters)Session["InitPar"]);

                    /*if (obec.Permition != "002")
                     * {
                     *  FormsAuthentication.SignOut();
                     *  FormsAuthentication.RedirectToLoginPage();
                     * }
                     * else
                     * {*/
                    gdvdln1.Columns[10].Visible = true;
                    gdvdln1.Columns[11].Visible = true;
                    //gdvdln1.Columns[12].Visible = true;
                    Set_Permissions();
                    Session["odln"] = new List <BEDocument>();
                    Session["dln1"] = new List <BEDocumentLine>();
                    Session["ordr"] = new List <BEDocument>();
                    Session["rdr1"] = new List <BEDocumentLine>();
                    Session["ocrd"] = new List <BEClient>();
                    Session["oitm"] = new List <BEProduct>();
                    hdfTemp.Add("theme", ASPxWebControl.GlobalTheme);
                    hdfTemp.Add("_emid", obec.U_BF_EMID);
                    hdfTemp.Add("_soci", obec.Socied);
                    hdfTemp.Add("_proj", obec.Project);
                    hdfTemp.Add("Reserve", string.Empty);
                    if (Session["cnoi"] != null)
                    {
                        ocno = (BEDocument)Session["cnoi"];
                        var i = 1;
                        ocno.Lines.ForEach(item =>
                        {
                            item.LineNum = i;
                            i           += 1;
                        });

                        hdfTemp.Set("Reserve", ocno.Reserve);
                        Session["dln1"]    = ocno.Lines;
                        gdvdln1.DataSource = ocno.Lines;
                        gdvdln1.DataBind();
                        Session["cnoi"] = null;
                    }

                    var _sd = obec.RAZON_SOCIAL;
                    ((HtmlAnchor)BSFindControl.FindControlRecursive(Master, "Socied")).InnerText  = _sd;
                    ((HtmlAnchor)BSFindControl.FindControlRecursive(Master, "Local")).InnerText   = obec.DscpLocal;
                    ((ASPxLabel)BSFindControl.FindControlRecursive(Master, "lblTypeChange")).Text = "Tipo de Cambio: " + obec.Rate.ToString("c3");
                    //}
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(User.Identity.Name))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
            }
            else
            {
                if (!IsPostBack && !IsCallback)
                {
                    var obec = ((BEParameters)Session["InitPar"]);
                    if (obec.Permition == "001")
                    {
                        FormsAuthentication.SignOut();
                        FormsAuthentication.RedirectToLoginPage();
                    }
                    else
                    {
                        Session["dln1"] = new List<BEDocumentLine>();
                        Session["ocrd"] = new List<BEClient>();
                        Session["oitm"] = new List<BEProduct>();
                        hdfTemp.Add("theme", ASPxWebControl.GlobalTheme);
                        hdfTemp.Add("_emid", obec.U_BF_EMID);
                        hdfTemp.Add("_soci", obec.Socied);
                        hdfTemp.Add("_proj", obec.Project);
                        hdfTemp.Add("Reserve", string.Empty);
                        hdfTemp.Add("_distri", string.Empty);
                        hdfTemp.Add("_xmsg", string.Empty);
                        if (Session["cnoi"] != null)
                        {
                            ocno = (BEDocument)Session["cnoi"];
                            var i = 1;
                            ocno.Lines.ForEach(item =>
                            {
                                item.LineNum = i;
                                i += 1;
                            });

                            hdfTemp.Set("Reserve", ocno.Reserve);
                            Session["dln1"] = ocno.Lines;
                            Session["cnoi"] = null;
                        }
                        //Init_VarSessions();
                        Set_Permissions();
                        var mmp = ((ASPxNavBar)Master.FindControl("nvbMain"));
                       
                        var _sd = ((string.Compare(obec.Socied, "BT", false) == 0) ? "Botica Francesa" : "Belmay");
                        ((HtmlAnchor)BSFindControl.FindControlRecursive(Master, "Socied")).InnerText = _sd;
                        ((HtmlAnchor)BSFindControl.FindControlRecursive(Master, "Local")).InnerText = obec.DscpLocal;
                        ((ASPxLabel)BSFindControl.FindControlRecursive(Master, "lblTypeChange")).Text = "Tipo de Cambio: " + obec.Rate.ToString("c3");
                    }


                }

            }
           
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["print"] != null)
            {
                ocno = (BEDocument)Session["print"];
                var            obec   = ((BEParameters)Session["InitPar"]);
                var            obrd   = new BRDocument();
                ReportDocument cryRpt = new ReportDocument();
                var            list   = obrd.DXP_GET_URL_FORMATOIMPRESION(new BEParameters()
                {
                    Socied = obec.Socied
                });
                //
                list.Where(item => item.U_DXP_NOMBRE_PARAMET == ocno.formatoImpresion).ToList().ForEach(i =>
                {
                    cryRpt.Load(i.U_DXP_VALOR_PARAMETR);
                });

                string var1        = ocno.DocEntry.ToString();//Request.QueryString["docEnry"];
                String strServer   = "SRV-SQL01";
                String strDatabase = obec.CompanyDB;
                String strUserID   = "sa";
                String strPwd      = "MPP@SW0RD";
                CrystalReportViewer1.Width  = new Unit("2000px");
                CrystalReportViewer1.Height = new Unit("2000px");

                cryRpt.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserID, strPwd);

                cryRpt.SetParameterValue(0, var1);
                CrystalReportViewer1.ReportSource = cryRpt;

                cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Crystal");
                Response.End();
            }

            ///////////////////////////////////////////////////////////////////////

            //ReportDocument cryRpt = new ReportDocument();
            ////string rpt = Request.QueryString["rpt"];
            //cryRpt.Load(Server.MapPath("FacturaOdex.rpt"));
            //string var1 = "18";//Request.QueryString["docEnry"];

            //String strServer = "SRV-SQL01";
            //String strDatabase = "SBO_DEXO";
            //String strUserID = "sa";
            //String strPwd = "MPP@SW0RD";
            //CrystalReportViewer1.Width = new Unit("2000px");
            //CrystalReportViewer1.Height = new Unit("2000px");

            //cryRpt.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserID, strPwd);

            //cryRpt.SetParameterValue(0, var1);
            //CrystalReportViewer1.ReportSource = cryRpt;

            //cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Crystal");
            //Response.End();
        }
Ejemplo n.º 4
0
        private string Save()
        {
            var _err = string.Empty;

            if (((List <BEDocumentLine>)Session["rin1"]).Count == 0)
            {
                _err = BSMessage.MsExLinesCount;
            }
            //if (cbeOwnerCode.Value == null)
            //    _err = BSMessage.MsExLinesCount;

            if (string.IsNullOrWhiteSpace(_err))
            {
                var obec = ((BEParameters)Session["InitPar"]);
                var obj  = new BEDocument();
                obj.Socied         = obec.Socied;
                obj.DocDate        = Convert.ToDateTime(dteDocDate.Text);
                obj.CardCode       = txtCardCode.Text;
                obj.CardName       = bteCardName.Text.Trim();
                obj.LicTradNum     = bteLicTradNum.Text.Trim();
                obj.U_BPP_MDTD     = cbbU_BPP_MDTD.Value.ToString();
                obj.U_BPP_MDSD     = txtU_BPP_MDSD.Text;
                obj.U_BPP_MDCD     = txtU_BPP_MDCD.Text;
                obj.NumAtCard      = NumAtCard.Text;
                obj.Currency       = cbbDocCur.Value.ToString();
                obj.DiscPrcntTotal = Convert.ToDecimal(alphanumeric(txtDiscPrcntTotal.Value.ToString()));
                obj.TotalExpns     = Convert.ToDecimal(alphanumeric(txtTotalExpns.Value.ToString()));
                obj.SlpCode        = Convert.ToInt16(cbeSalesPerson.Value);
                obj.OwnerCode      = Convert.ToInt32(cbeOwnerCode.Value);
                obj.GroupNum       = Convert.ToInt16(cbbGroupNum.Value);
                obj.Comments       = mmoComments.Text;
                if (string.IsNullOrEmpty(cbbPersonContact.Value.ToString()))
                {
                    obj.CntctCode = 0;
                }
                else
                {
                    obj.CntctCode = Convert.ToInt32(cbbPersonContact.Value.ToString());
                }
                //obj.U_BF_PED_ORIG = txtU_BF_PED_ORIG0.Text;
                obj.Project = ((BEParameters)Session["InitPar"]).Project;
                //obj.U_BF_PickRmrk = User.Identity.Name;
                //Qua_BatchNum();
                obj.Lines   = ((List <BEDocumentLine>)Session["rin1"]);
                obj.Reserve = hdfTemp.Get("Reserve").ToString();
                using (var obrd = new BRDocument())
                {
                    obrd.SavePurchaseCreditNote(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
                }
                _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKS#{0}#{1}", obj.DocEntry, obj.DocNum);
            }
            return(_err);
        }
Ejemplo n.º 5
0
        private string Cancel()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BEDocument();

            obj.Socied   = obec.Socied;
            obj.DocEntry = Convert.ToInt32(txtDocEntry.Text);
            using (var obrd = new BRDocument())
            {
                obrd.CancelDeliveryNote(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : "OKOC";

            return(_err);
        }
        private string Save()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BEDocument();

            obj.CardCode = bteCustomer.Text;
            obj.DocDate  = Convert.ToDateTime(txtcreateDate1.Text);
            obj.Lineas   = ((List <BEDocument>)Session["jdt1"]);
            obj.Credit   = Convert.ToDecimal(txtCred.Text);
            obj.Debit    = Convert.ToDecimal(txtDeb.Text);
            obj.Socied   = obec.Socied;
            using (var obrd = new BRDocument())
            {
                obrd.SaveRecon(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : "OKBP";

            return(_err);
        }
Ejemplo n.º 7
0
        private string Payment(int DocEntry)
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var item = ((List <BEDocument>)Session["dvpp"]).Where(i => i.DocEntry == DocEntry).ElementAt(0);
            var obj  = new BEDocument();

            obj.Socied   = obec.Socied;
            obj.DocEntry = DocEntry;
            obj.DocDate  = DateTime.Today;
            obj.CardCode = item.CardCode;
            obj.CardName = item.CardName;
            if (pgcPayment.ActiveTabIndex == 0)
            {
                obj.MedPayment  = "EF";
                obj.CashAccount = (obec.Socied == "BT") ? "_SYS00000003803" : "_SYS00000003232";
                obj.CashSum     = Convert.ToDecimal(txtSalEfe.Value);
            }
            else
            {
                obj.MedPayment = "TC";
                var _stc = cbbCreditCard.Value.ToString().Split('_');
                obj.CreditCard  = Convert.ToInt16(_stc[0]);
                obj.CashAccount = "_" + _stc[1];
                obj.CashSum     = Convert.ToDecimal(txtSalTacre.Value);
                var _ccn = ("0000000000000" + txtCardNum.Text);
                obj.CreditCardNumber = Right(_ccn, 13);
                obj.VoucherNum       = txtCardNum.Text;
            }
            obj.Project    = ((BEParameters)Session["InitPar"]).Project;
            obj.PaidToDate = item.PaidToDate + obj.CashSum;
            obj.PendingBal = item.DocTotal - obj.PaidToDate;

            using (var obrd = new BRDocument())
            {
                obrd.SavePayment(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKP#{0}#{1}#{2}", DocEntry, obj.PaidToDate, obj.PendingBal);

            return(_err);
        }
        private string Save()
        {
            var _err = string.Empty;
            var MSJ  = "";
            var band = false;

            if (((List <BEDocumentLine>)Session["dln1"]).Count == 0)
            {
                _err = BSMessage.MsExLinesCount;
            }


            if (string.IsNullOrWhiteSpace(_err))
            {
                var day  = DateTime.Today;
                var obec = ((BEParameters)Session["InitPar"]);
                var obj  = new BEDocument();
                obj.Socied   = obec.Socied;
                obj.DocDate  = Convert.ToDateTime(day);
                obj.TaxDate  = Convert.ToDateTime(day);
                obj.CardCode = bteCustomer.Text;
                obj.CardName = txtCustomerName.Text;

                obj.U_BPP_MDTO = txtidllamada.Text;

                obj.Project = ((BEParameters)Session["InitPar"]).Project;

                List <BEProduct> listSN = SerialNumber();
                obj.Lines = ((List <BEDocumentLine>)Session["dln1"]);



                using (var obrd = new BRDocument())
                {
                    obrd.SaveDeliveryNote2(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
                }
                _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKS#{0}#{1}", obj.DocEntry, obj.DocNum);
            }
            return(_err);
        }
Ejemplo n.º 9
0
        private string Payment()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BEDocument();

            obj.Socied   = obec.Socied;
            obj.DocEntry = Convert.ToInt32(txtDocEntry.Value);
            obj.DocDate  = DateTime.Today;
            obj.CardCode = txtCardCode.Text;
            obj.CardName = bteCardName.Text.Trim();
            if (pgcPayment.ActiveTabIndex == 0)
            {
                obj.MedPayment  = "EF";
                obj.CashAccount = "_SYS00000003803";
                obj.CashSum     = Convert.ToDecimal(txtSalEfe.Value);
            }
            else
            {
                obj.MedPayment = "TC";
                var _stc = cbbCreditCard.Value.ToString().Split('_');
                obj.CreditCard  = Convert.ToInt16(_stc[0]);
                obj.CashAccount = "_" + _stc[1];
                obj.CashSum     = Convert.ToDecimal(txtSalTacre.Value);
                var _ccn = ("0000000000000" + txtCardNum.Text);
                obj.CreditCardNumber = Right(_ccn, 13);
                obj.VoucherNum       = txtCardNum.Text;
            }
            obj.Project    = ((BEParameters)Session["InitPar"]).Project;
            obj.PaidToDate = Convert.ToDecimal(txtPaidToDate.Value) + obj.CashSum;
            obj.PendingBal = Convert.ToDecimal(txtDocTotal.Value) - obj.PaidToDate;

            using (var obrd = new BRDocument())
            {
                obrd.SavePayment(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKP#{0}#{1}", obj.PaidToDate, obj.PendingBal);

            return(_err);
        }
Ejemplo n.º 10
0
        private string Cancel()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BEDocument();

            if (rbtnType.Value.ToString() == "Y")
            {
                obj.DocEntry = Convert.ToInt32(txtDocNum.Text);
            }
            else
            {
                obj.DocEntry = Convert.ToInt32(txtDocNum2.Text);
            }
            using (var obrd = new BRDocument())
            {
                obrd.CancelPayment(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : "CANC";

            //Init_VarSessions();
            return(_err);
        }
Ejemplo n.º 11
0
        private string Notes(string par)
        {
            var obj = new BEDocument();

            obj.DocEntry       = Convert.ToInt32(txtDocEntry.Value);
            obj.DocNum         = Convert.ToInt32(txtDocNum.Value);
            obj.DocDate        = Convert.ToDateTime(dteDocDate.Text);
            obj.CardCode       = txtCardCode.Text;
            obj.CardName       = bteCardName.Text.Trim();
            obj.LicTradNum     = bteLicTradNum.Text.Trim();
            obj.NumAtCard      = txtNumAtCard.Text;
            obj.DiscPrcntTotal = Convert.ToDecimal(txtDiscPrcntTotal.Value);
            obj.TotalExpns     = Convert.ToDecimal(txtTotalExpns.Value);
            obj.SlpCode        = Convert.ToInt16(cbeSalesPerson.Value);
            obj.OwnerCode      = Convert.ToInt32(cbeOwnerCode.Value);
            obj.GroupNum       = Convert.ToInt16(cbbGroupNum.Value);
            obj.Comments       = mmoComments.Text;
            obj.Reserve        = "Y";
            obj.Lines          = ((List <BEDocumentLine>)Session["inv1"]).Where(i => i.LineStatus != "C").ToList();
            obj.Lines.ForEach(item =>
            {
                item.Quantity  = item.OpenQty;
                item.BaseType  = Convert.ToInt32(item.ObjType);
                item.BaseEntry = item.DocEntry;
                item.BaseLine  = item.LineNum - 1;
                item._Quantity = item.Quantity;
                item.BatchNum  = item.BatchNums;
            });
            Session["cnoi"] = obj;

            var _msg = "OKCN";

            if (par == "DlNote")
            {
                _msg = "OKDN";
            }
            return(_msg);
        }
Ejemplo n.º 12
0
        private string SaveTS()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obj  = new BEDocument();

            obj.CardCode = bteCustomer.Text;
            obj.CardName = txtCustomerName.Text;
            obj.Address  = txtAddress.Text;
            obj.DocDate  = Convert.ToDateTime(txtcreateDate1.Text);
            obj.SlpCode  = Convert.ToInt32(cbeOwnerCode.Value);
            obj.AlmacenO = cbbalmacenorigen.Value.ToString();
            obj.AlmacenD = cbbalmacendestino.Value.ToString();
            obj.Lines    = ((List <BEDocumentLine>)Session["wtr1"]);

            using (var obrd = new BRDocument())
            {
                obrd.SaveTransferenciaStock(obj, ((BEParameters)Session["InitPar"]).objSapSbo);
            }
            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKBP#{0}#{1}", obj.DocEntry, obj.DocNum);

            //Init_VarSessions();
            return(_err);
        }
Ejemplo n.º 13
0
        public static bool Get_Mobility(BEDocument obj, List <BEParMovility> prmv)
        {
            bool mvl = false;

            if (string.Compare(obj.U_BIZ_LUEN, "006", false) == 0 && obj.DocTotal > 0)
            {
                var count = prmv.Where(lobj => string.Compare(lobj.U_BF_CODI, obj.U_BIZ_CODI, false) == 0 &&
                                       string.Compare(lobj.U_BF_DIA, "Vacio", false) == 0 && obj.DocTotal >= lobj.U_BF_TOTA).Count();

                if (count == 0)
                {
                    var    per  = CultureInfo.GetCultureInfo("es-PE");
                    int    day  = (int)obj.DocDueDate.DayOfWeek;
                    string dayn = per.DateTimeFormat.DayNames[day];
                    count = prmv.Where(lobj => string.Compare(lobj.U_BF_CODI, obj.U_BIZ_CODI, false) == 0 &&
                                       string.Compare(lobj.U_BF_DIA.ToUpper(), dayn.ToUpper(), false) == 0 && obj.DocTotal > 0 && obj.DocTotal < 200).Count();
                    if (count == 0)
                    {
                        mvl = true;
                    }
                }
            }
            return(mvl);
        }
        protected void gdvrin1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            var obec = ((BEParameters)Session["InitPar"]);

            if (e.Parameters.Contains("QK"))
            {
                var obep = new BEParameters()
                {
                    Socied      = obec.Socied,
                    CardCode    = txtCardCode.Text,
                    PriceList   = Convert.ToInt16(cbbListNum.Value),
                    WhsCode     = obec.WhsCode,
                    ParValue    = e.Parameters.Replace("QK:", "").ToUpper().Replace("K", "").Trim(),
                    ColumnIndex = 0,
                    Sw          = 2
                };
                var obrd = new BRDocument();
                var olst = obrd.Get_OSCSP_KITS(obep);

                var _qtk = (chkKit.Checked) ? Convert.ToInt32(txtQuantityKit.Text) : Convert.ToInt32(txtQKit.Text);
                olst.ForEach(item =>
                {
                    var line = new BEDocumentLine()
                    {
                        ItemCode    = item.ItemCode,
                        ItemName    = item.ItemName,
                        Quantity    = _qtk,
                        PriceBefDi  = item.PriceBefDi,
                        DiscPrcnt   = item.DiscPrcnt,
                        Price       = item.Price,
                        LineTotal   = Convert.ToDecimal(_qtk * item.Price),
                        GTotal      = Convert.ToDecimal(_qtk * item.PriceVat),
                        BatchNum    = item.BatchNum,
                        WhsCode     = obec.WhsCode,
                        U_BF_CodKit = item.U_BF_CodKit
                    };
                    ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                });
                Set_LineNum();
            }
            else if (e.Parameters.Contains("UPDTPRICE"))
            {
                var _spl = e.Parameters.Split(':');
                ((List <BEDocumentLine>)Session["rin1"]).Where(i => (i.TreeType == "N" && i.Father == _spl[5]))
                .ToList().ForEach(item =>
                {
                    item.PriceBefDi = Convert.ToDecimal(_spl[1]);
                    item.Price      = Convert.ToDecimal(_spl[2]);
                    item.LineTotal  = Convert.ToDecimal(_spl[3]);
                    item.GTotal     = Convert.ToDecimal(_spl[4]);
                    item.Quantity   = Convert.ToInt32(_spl[6]);
                });
            }
            else if (e.Parameters.Contains("CLR"))
            {
                Session["cnoi"] = null;
                ocno            = new BEDocument();
                ((List <BEDocumentLine>)Session["rin1"]).Clear();
            }
            else if (e.Parameters.Contains("LM"))
            {
                var band     = true;
                var suprimir = "";
                var _spl     = e.Parameters.Split(':');
                var padre    = _spl[1].Split(',');

                var obep = new BEParameters()
                {
                    Socied   = obec.Socied,
                    ItemCode = Convert.ToString(padre[0])
                };
                var obrd  = new BRDocument();
                var olist = obrd.Get_ListdeMateriales(obep);
                if (olist.Count != 0)
                {
                    olist.ForEach(item =>
                    {
                        obep = new BEParameters()
                        {
                            Socied      = obec.Socied,
                            Project     = obec.Project,
                            CardCode    = "",
                            PriceList   = Convert.ToInt16(_spl[2]),
                            WhsCode     = item.Warehouse,
                            ParValue    = item.Code,
                            ColumnIndex = 0,
                            Sw          = 2,
                            Kit         = false
                        };
                        var olst = obrd.Get_OSCSP_OITM_P(obep);

                        var line = new BEDocumentLine();

                        if (band)
                        {
                            line.ItemCode   = padre[0];
                            line.ItemName   = padre[1];
                            line.PriceBefDi = Convert.ToDecimal(padre[3]);
                            line.Quantity   = 1;
                            line.DiscPrcnt  = Convert.ToDecimal(padre[4]);
                            line.Price      = Convert.ToDecimal(padre[5]);
                            line.LineTotal  = Convert.ToDecimal(padre[5]);
                            line.GTotal     = Convert.ToDecimal(padre[6]);
                            line.IssueMthd  = padre[7];
                            line.WhsCode    = obec.WhsCode;
                            line.TreeType   = "S";
                            line.Father     = padre[0];
                            line.NumInSale  = Convert.ToInt32(padre[8]);
                            band            = false;
                            suprimir        = item.SUPRIMIR_MATERIALES;
                            ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                            Set_LineNum();
                        }
                        olst.ForEach(a =>
                        {
                            var line2        = new BEDocumentLine();
                            line2.ItemCode   = a.ItemCode;
                            line2.ItemName   = a.ItemName;
                            line2.PriceBefDi = a.PriceBefDi;
                            line2.Quantity   = item.Quantity;
                            line2.DiscPrcnt  = a.DiscPrcnt;
                            line2.Price      = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100);
                            line2.LineTotal  = item.Quantity * a.Price;
                            line2.GTotal     = item.Quantity * a.PriceVat;
                            line2.IssueMthd  = a.IssueMthd;
                            line2.WhsCode    = obec.WhsCode;
                            line2.TreeType   = "I";
                            line2.Father     = padre[0];
                            line2.NumInSale  = item.Quantity;
                            ((List <BEDocumentLine>)Session["rin1"]).Add(line2);
                            Set_LineNum();
                        });
                    });
                    if (suprimir == "N")
                    {
                        ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "S" && i.Father == padre[0]).ToList().ForEach(x =>
                        {
                            x.PriceBefDi = Convert.ToDecimal(0.00);
                            x.Price      = Convert.ToDecimal(0.00);
                            x.LineTotal  = Convert.ToDecimal(0.00);
                            x.GTotal     = Convert.ToDecimal(0.00);
                        });
                    }
                    else if (suprimir == "Y")
                    {
                        ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "I" && i.Father == padre[0]).ToList().ForEach(x =>
                        {
                            x.PriceBefDi = Convert.ToDecimal(0.00);
                            x.Price      = Convert.ToDecimal(0.00);
                            x.LineTotal  = Convert.ToDecimal(0.00);
                            x.GTotal     = Convert.ToDecimal(0.00);
                        });
                    }
                }
                else
                {
                    var line = new BEDocumentLine();
                    //return;
                    line.ItemCode   = padre[0];
                    line.ItemName   = padre[1];
                    line.PriceBefDi = Convert.ToDecimal(padre[3]);
                    line.Quantity   = 1;
                    line.DiscPrcnt  = Convert.ToDecimal(padre[4]);
                    line.Price      = Convert.ToDecimal(padre[5]);
                    line.LineTotal  = Convert.ToDecimal(padre[5]);
                    line.GTotal     = Convert.ToDecimal(padre[6]);
                    line.IssueMthd  = padre[7];
                    line.WhsCode    = obec.WhsCode;
                    line.TreeType   = "N";
                    line.Father     = padre[0];
                    line.NumInSale  = Convert.ToInt32(padre[8]);
                    band            = false;
                    //suprimir = item.SUPRIMIR_MATERIALES;
                    ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                    Set_LineNum();
                }
            }
            else if (e.Parameters.Contains("QTY"))
            {
                var _spl = e.Parameters.Split(':');
                var band = true;
                ((List <BEDocumentLine>)Session["rin1"]).Where(i => ((i.TreeType == "I" || i.TreeType == "S" || i.TreeType == "N") && i.Father == _spl[2]))
                .ToList().ForEach(item =>
                {
                    band = false;
                    if (item.TreeType == "N")
                    {
                        item.Quantity  = Convert.ToInt32(_spl[1]);
                        item.LineTotal = item.Quantity * item.Price;
                        item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                    }
                    else if (item.TreeType == "S" || item.TreeType == "I")
                    {
                        if (item.TreeType == "S")
                        {
                            item.Quantity  = Convert.ToInt32(_spl[1]);
                            item.LineTotal = item.Quantity * item.Price;
                            item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                        }
                        else if (item.TreeType == "I")
                        {
                            item.Quantity  = Convert.ToInt32(item.NumInSale) * Convert.ToInt32(_spl[1]);
                            item.LineTotal = item.Quantity * item.Price;
                            item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                        }
                    }
                });
                if (band)
                {
                    return;
                }
            }
            else if (e.Parameters.Contains("ADDPRODUCT"))
            {
                var _spl     = e.Parameters.Split(':');
                var obep     = new BEParameters();
                var obrd     = new BRDocument();
                var suprimir = "";

                obep = new BEParameters()
                {
                    Socied      = obec.Socied,
                    Project     = obec.Project,
                    CardCode    = "",
                    PriceList   = Convert.ToInt16(_spl[2]),
                    WhsCode     = obec.WhsCode,
                    ParValue    = _spl[1],
                    ColumnIndex = 0,
                    Sw          = 2,
                    Kit         = false,
                    ItemCode    = _spl[1]
                };
                var articulo        = obrd.Get_OSCSP_OITM_P(obep);
                var listamateriales = obrd.Get_ListdeMateriales(obep);

                if (listamateriales.Count == 0)
                {
                    articulo.ForEach(item =>
                    {
                        var line = new BEDocumentLine();

                        line.ItemCode   = item.ItemCode;
                        line.ItemName   = item.ItemName;
                        line.PriceBefDi = Convert.ToDecimal(item.PriceBefDi);
                        line.Quantity   = 1;
                        line.DiscPrcnt  = Convert.ToDecimal(item.DiscPrcnt);
                        line.Price      = Convert.ToDecimal(item.Price);
                        line.LineTotal  = Convert.ToDecimal(item.Price);
                        line.GTotal     = Convert.ToDecimal(item.PriceVat);
                        line.IssueMthd  = item.IssueMthd;
                        line.WhsCode    = obec.WhsCode;
                        line.TreeType   = "N";
                        line.Father     = item.ItemCode;
                        line.NumInSale  = Convert.ToInt32(item.NumInSale);

                        ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                        Set_LineNum();
                    });
                }
                else
                {
                    articulo.ForEach(i =>
                    {
                        var line = new BEDocumentLine();

                        line.ItemCode   = i.ItemCode;
                        line.ItemName   = i.ItemName;
                        line.PriceBefDi = Convert.ToDecimal(i.PriceBefDi);
                        line.Quantity   = 1;
                        line.DiscPrcnt  = Convert.ToDecimal(i.DiscPrcnt);
                        line.Price      = Convert.ToDecimal(i.Price);
                        line.LineTotal  = Convert.ToDecimal(i.Price);
                        line.GTotal     = Convert.ToDecimal(i.PriceVat);
                        line.IssueMthd  = i.IssueMthd;
                        line.WhsCode    = obec.WhsCode;
                        line.TreeType   = "S";
                        line.Father     = i.ItemCode;
                        line.NumInSale  = Convert.ToInt32(i.NumInSale);

                        ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                        Set_LineNum();

                        listamateriales.ForEach(j =>
                        {
                            obep = new BEParameters()
                            {
                                Socied      = obec.Socied,
                                Project     = obec.Project,
                                CardCode    = "",
                                PriceList   = Convert.ToInt16(_spl[2]),
                                WhsCode     = obec.WhsCode,
                                ParValue    = j.Code,
                                ColumnIndex = 0,
                                Sw          = 2,
                                Kit         = false
                            };

                            var articulosdelista = obrd.Get_OSCSP_OITM_P(obep);
                            suprimir             = j.SUPRIMIR_MATERIALES;

                            articulosdelista.ForEach(a =>
                            {
                                var line2 = new BEDocumentLine();

                                line2.ItemCode   = a.ItemCode;
                                line2.ItemName   = a.ItemName;
                                line2.PriceBefDi = a.PriceBefDi;
                                line2.Quantity   = j.Quantity;
                                line2.DiscPrcnt  = a.DiscPrcnt;
                                line2.Price      = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100);
                                line2.LineTotal  = j.Quantity * a.Price;
                                line2.GTotal     = j.Quantity * a.PriceVat;
                                line2.IssueMthd  = a.IssueMthd;
                                line2.WhsCode    = obec.WhsCode;
                                line2.TreeType   = "I";
                                line2.Father     = i.ItemCode;
                                line2.NumInSale  = j.Quantity;

                                ((List <BEDocumentLine>)Session["rin1"]).Add(line2);
                                Set_LineNum();
                            });
                        });
                        if (suprimir == "N")
                        {
                            ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "S" && a.Father == i.ItemCode)).ToList().ForEach(x =>
                            {
                                x.PriceBefDi = Convert.ToDecimal(0.00);
                                x.Price      = Convert.ToDecimal(0.00);
                                x.LineTotal  = Convert.ToDecimal(0.00);
                                x.GTotal     = Convert.ToDecimal(0.00);
                            });
                        }
                        else if (suprimir == "Y")
                        {
                            ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "I" && a.Father == i.ItemCode)).ToList().ForEach(x =>
                            {
                                x.PriceBefDi = Convert.ToDecimal(0.00);
                                x.Price      = Convert.ToDecimal(0.00);
                                x.LineTotal  = Convert.ToDecimal(0.00);
                                x.GTotal     = Convert.ToDecimal(0.00);
                            });
                        }
                    });
                }
            }
            else if (e.Parameters.Contains("SRCH"))
            {
                var obep = new BEParameters()
                {
                    Socied   = obec.Socied,
                    DocEntry = Convert.ToInt32(txtDocEntry.Text)
                };
                var obrd = new BRDocument();
                Session["rin1"] = obrd.Get_OSCSP_SRCH_RPC1(obep);
            }

            gdvrin1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["rin1"]).Sum(item => Math.Round(item.LineTotal, 2));

            gdvrin1.CancelEdit();
            gdvrin1.DataSource = ((List <BEDocumentLine>)Session["rin1"]);
            gdvrin1.DataBind();
        }
Ejemplo n.º 15
0
        protected void gdvrin1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            var obec = ((BEParameters)Session["InitPar"]);

            if (e.Parameters.Contains("UPDTPRICE"))
            {
                var _spl = e.Parameters.Split(':');
                ((List <BEDocumentLine>)Session["rin1"]).Where(i => (i.TreeType == "N" && i.Father == _spl[5]))
                .ToList().ForEach(item =>
                {
                    item.PriceBefDi = Convert.ToDecimal(_spl[1]);
                    item.Price      = Convert.ToDecimal(_spl[2]);
                    item.LineTotal  = Convert.ToDecimal(_spl[3]);
                    item.GTotal     = Convert.ToDecimal(_spl[4]);
                    item.Quantity   = Convert.ToDecimal(_spl[6]);
                });
            }
            else if (e.Parameters.Contains("CLR"))
            {
                Session["cnoi"] = null;
                ocno            = new BEDocument();
                ((List <BEDocumentLine>)Session["rin1"]).Clear();
            }
            else if (e.Parameters.Contains("LM"))
            {
                var band     = true;
                var suprimir = "";
                var _spl     = e.Parameters.Split(':');
                var padre    = _spl[1].Split(',');

                var obep = new BEParameters()
                {
                    Socied   = obec.Socied,
                    ItemCode = Convert.ToString(padre[0])
                };
                var obrd  = new BRDocument();
                var olist = obrd.Get_ListdeMateriales(obep);
                if (olist.Count != 0)
                {
                    olist.ForEach(item =>
                    {
                        obep = new BEParameters()
                        {
                            Socied      = obec.Socied,
                            Project     = obec.Project,
                            CardCode    = "",
                            PriceList   = Convert.ToInt16(_spl[2]),
                            WhsCode     = cbbWareHouse.Value.ToString(),
                            ParValue    = item.Code,
                            ColumnIndex = 0,
                            Sw          = 2,
                            Kit         = false,
                            Moneda      = cbbDocCur.Value.ToString(),
                            DateIn      = Convert.ToDateTime(dteDocDate.Text),
                            Descripcion = "",
                            SerieMaqr   = ""
                        };
                        var olst = obrd.Get_OSCSP_OITM_P(obep);

                        var line = new BEDocumentLine();

                        if (band)
                        {
                            line.ItemCode   = padre[0];
                            line.ItemName   = padre[1];
                            line.PriceBefDi = Convert.ToDecimal(padre[3]);
                            line.Quantity   = 1;
                            line.DiscPrcnt  = Convert.ToDecimal(padre[4]);
                            line.Price      = Convert.ToDecimal(padre[5]);
                            line.LineTotal  = Convert.ToDecimal(padre[5]);
                            line.GTotal     = Convert.ToDecimal(padre[6]);
                            line.IssueMthd  = padre[7];
                            line.WhsCode    = obec.WhsCode;
                            line.TreeType   = "S";
                            line.Father     = padre[0];
                            line.NumInBuy   = Convert.ToInt32(padre[8]);
                            line.ActivoC    = padre[9];
                            line.ActivoS    = padre[10];
                            line.InvntItem  = padre[11];
                            line.LastPurCur = padre[12];
                            band            = false;
                            suprimir        = item.SUPRIMIR_MATERIALES;
                            ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                            Set_LineNum();
                        }
                        olst.ForEach(a =>
                        {
                            var line2        = new BEDocumentLine();
                            line2.ItemCode   = a.ItemCode;
                            line2.ItemName   = a.ItemName;
                            line2.PriceBefDi = a.PriceBefDi;
                            line2.Quantity   = item.Quantity;
                            line2.DiscPrcnt  = a.DiscPrcnt;
                            line2.Price      = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100);
                            line2.LineTotal  = item.Quantity * a.Price;
                            line2.GTotal     = item.Quantity * a.PriceVat;
                            line2.IssueMthd  = a.IssueMthd;
                            line2.WhsCode    = obec.WhsCode;
                            line2.TreeType   = "I";
                            line2.Father     = padre[0];
                            line2.NumInBuy   = item.Quantity;
                            line2.ActivoC    = a.ActivoC;
                            line2.ActivoS    = a.ActivoS;
                            line2.InvntItem  = a.InvntItem;
                            line2.LastPurCur = a.LastPurCur;
                            ((List <BEDocumentLine>)Session["rin1"]).Add(line2);
                            Set_LineNum();
                        });
                    });
                    if (suprimir == "N")
                    {
                        ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "S" && i.Father == padre[0]).ToList().ForEach(x =>
                        {
                            x.PriceBefDi = Convert.ToDecimal(0.00);
                            x.Price      = Convert.ToDecimal(0.00);
                            x.LineTotal  = Convert.ToDecimal(0.00);
                            x.GTotal     = Convert.ToDecimal(0.00);
                        });
                    }
                    else if (suprimir == "Y")
                    {
                        ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "I" && i.Father == padre[0]).ToList().ForEach(x =>
                        {
                            x.PriceBefDi = Convert.ToDecimal(0.00);
                            x.Price      = Convert.ToDecimal(0.00);
                            x.LineTotal  = Convert.ToDecimal(0.00);
                            x.GTotal     = Convert.ToDecimal(0.00);
                        });
                    }
                }
                else
                {
                    var line = new BEDocumentLine();

                    //return;
                    line.ItemCode   = padre[0];
                    line.ItemName   = padre[1];
                    line.PriceBefDi = Convert.ToDecimal(padre[3]);
                    line.Quantity   = 1;
                    line.DiscPrcnt  = Convert.ToDecimal(padre[4]);
                    line.Price      = Convert.ToDecimal(padre[5]);
                    line.LineTotal  = Convert.ToDecimal(padre[5]);
                    line.GTotal     = Convert.ToDecimal(padre[6]);
                    line.IssueMthd  = padre[7];
                    line.WhsCode    = obec.WhsCode;
                    line.TreeType   = "N";
                    line.Father     = padre[0];
                    line.NumInBuy   = Convert.ToInt32(padre[8]);
                    line.ActivoC    = padre[9];
                    line.ActivoS    = padre[10];
                    line.InvntItem  = padre[11];
                    line.LastPurCur = padre[12];
                    band            = false;
                    //suprimir = item.SUPRIMIR_MATERIALES;
                    ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                    Set_LineNum();
                }
            }
            else if (e.Parameters.Contains("QTY"))
            {
                var _spl = e.Parameters.Split(':');
                var band = true;
                ((List <BEDocumentLine>)Session["rin1"]).Where(i => ((i.TreeType == "I" || i.TreeType == "S" || i.TreeType == "N") && i.Father == _spl[2]))
                .ToList().ForEach(item =>
                {
                    band = false;
                    if (item.TreeType == "N")
                    {
                        item.Quantity  = Convert.ToDecimal(_spl[1]);
                        item.LineTotal = item.Quantity * item.Price;
                        item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                    }
                    else if (item.TreeType == "S" || item.TreeType == "I")
                    {
                        if (item.TreeType == "S")
                        {
                            item.Quantity  = Convert.ToDecimal(_spl[1]);
                            item.LineTotal = item.Quantity * item.Price;
                            item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                        }
                        else if (item.TreeType == "I")
                        {
                            item.Quantity  = Convert.ToDecimal(item.NumInBuy) * Convert.ToDecimal(_spl[1]);
                            item.LineTotal = item.Quantity * item.Price;
                            item.GTotal    = item.LineTotal * Convert.ToDecimal(1.18);
                        }
                    }
                });
                if (band)
                {
                    return;
                }
            }
            else if (e.Parameters.Contains("ADDPRODUCT"))
            {
                var _spl     = e.Parameters.Split(':');
                var obep     = new BEParameters();
                var obrd     = new BRDocument();
                var suprimir = "";

                obep = new BEParameters()
                {
                    Socied      = obec.Socied,
                    Project     = obec.Project,
                    CardCode    = "",
                    PriceList   = Convert.ToInt16(_spl[2]),
                    WhsCode     = cbbWareHouse.Value.ToString(),
                    ParValue    = _spl[1],
                    ColumnIndex = 0,
                    Sw          = 2,
                    Kit         = false,
                    ItemCode    = _spl[1],
                    Moneda      = cbbDocCur.Value.ToString(),
                    DateIn      = Convert.ToDateTime(dteDocDate.Text),
                    Descripcion = "",
                    SerieMaqr   = ""
                };
                var articulo        = obrd.Get_OSCSP_OITM_P(obep);
                var listamateriales = obrd.Get_ListdeMateriales(obep);

                if (listamateriales.Count == 0)
                {
                    articulo.ForEach(item =>
                    {
                        var line = new BEDocumentLine();

                        line.ItemCode   = item.ItemCode;
                        line.ItemName   = item.ItemName;
                        line.PriceBefDi = Convert.ToDecimal(item.PriceBefDi);
                        line.Quantity   = 1;
                        line.DiscPrcnt  = Convert.ToDecimal(item.DiscPrcnt);
                        line.Price      = Convert.ToDecimal(item.Price);
                        line.LineTotal  = Convert.ToDecimal(item.Price);
                        line.GTotal     = Convert.ToDecimal(item.PriceVat);
                        line.IssueMthd  = item.IssueMthd;
                        line.WhsCode    = obec.WhsCode;
                        line.TreeType   = "N";
                        line.Father     = item.ItemCode;
                        line.NumInBuy   = Convert.ToInt32(item.NumInBuy);
                        line.ActivoC    = item.ActivoC;
                        line.ActivoS    = item.ActivoS;
                        line.InvntItem  = item.InvntItem;
                        line.LastPurCur = item.LastPurCur;
                        ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                        Set_LineNum();
                    });
                }
                else
                {
                    articulo.ForEach(i =>
                    {
                        var line = new BEDocumentLine();

                        line.ItemCode   = i.ItemCode;
                        line.ItemName   = i.ItemName;
                        line.PriceBefDi = Convert.ToDecimal(i.PriceBefDi);
                        line.Quantity   = 1;
                        line.DiscPrcnt  = Convert.ToDecimal(i.DiscPrcnt);
                        line.Price      = Convert.ToDecimal(i.Price);
                        line.LineTotal  = Convert.ToDecimal(i.Price);
                        line.GTotal     = Convert.ToDecimal(i.PriceVat);
                        line.IssueMthd  = i.IssueMthd;
                        line.WhsCode    = obec.WhsCode;
                        line.TreeType   = "S";
                        line.Father     = i.ItemCode;
                        line.NumInBuy   = Convert.ToInt32(i.NumInBuy);
                        line.ActivoC    = i.ActivoC;
                        line.ActivoS    = i.ActivoS;
                        line.InvntItem  = i.InvntItem;
                        line.LastPurCur = i.LastPurCur;
                        ((List <BEDocumentLine>)Session["rin1"]).Add(line);
                        Set_LineNum();

                        listamateriales.ForEach(j =>
                        {
                            obep = new BEParameters()
                            {
                                Socied      = obec.Socied,
                                Project     = obec.Project,
                                CardCode    = "",
                                PriceList   = Convert.ToInt16(_spl[2]),
                                WhsCode     = cbbWareHouse.Value.ToString(),
                                ParValue    = j.Code,
                                ColumnIndex = 0,
                                Sw          = 2,
                                Kit         = false,
                                Moneda      = cbbDocCur.Value.ToString(),
                                DateIn      = Convert.ToDateTime(dteDocDate.Text),
                                Descripcion = "",
                                SerieMaqr   = ""
                            };

                            var articulosdelista = obrd.Get_OSCSP_OITM_P(obep);
                            suprimir             = j.SUPRIMIR_MATERIALES;

                            articulosdelista.ForEach(a =>
                            {
                                var line2 = new BEDocumentLine();

                                line2.ItemCode   = a.ItemCode;
                                line2.ItemName   = a.ItemName;
                                line2.PriceBefDi = a.PriceBefDi;
                                line2.Quantity   = j.Quantity;
                                line2.DiscPrcnt  = a.DiscPrcnt;
                                line2.Price      = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100);
                                line2.LineTotal  = j.Quantity * a.Price;
                                line2.GTotal     = j.Quantity * a.PriceVat;
                                line2.IssueMthd  = a.IssueMthd;
                                line2.WhsCode    = obec.WhsCode;
                                line2.TreeType   = "I";
                                line2.Father     = i.ItemCode;
                                line2.NumInBuy   = j.Quantity;
                                line2.ActivoC    = a.ActivoC;
                                line2.ActivoS    = a.ActivoS;
                                line2.InvntItem  = a.InvntItem;
                                line2.LastPurCur = a.LastPurCur;
                                ((List <BEDocumentLine>)Session["rin1"]).Add(line2);
                                Set_LineNum();
                            });
                        });
                        if (suprimir == "N")
                        {
                            ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "S" && a.Father == i.ItemCode)).ToList().ForEach(x =>
                            {
                                x.PriceBefDi = Convert.ToDecimal(0.00);
                                x.Price      = Convert.ToDecimal(0.00);
                                x.LineTotal  = Convert.ToDecimal(0.00);
                                x.GTotal     = Convert.ToDecimal(0.00);
                            });
                        }
                        else if (suprimir == "Y")
                        {
                            ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "I" && a.Father == i.ItemCode)).ToList().ForEach(x =>
                            {
                                x.PriceBefDi = Convert.ToDecimal(0.00);
                                x.Price      = Convert.ToDecimal(0.00);
                                x.LineTotal  = Convert.ToDecimal(0.00);
                                x.GTotal     = Convert.ToDecimal(0.00);
                            });
                        }
                    });
                }
            }
            else if (e.Parameters.Contains("SRCH"))
            {
                var obep = new BEParameters()
                {
                    Socied   = obec.Socied,
                    DocEntry = Convert.ToInt32(txtDocEntry.Text)
                };
                var obrd = new BRDocument();
                Session["rin1"] = obrd.Get_OSCSP_SRCH_RPC1(obep);
            }

            gdvrin1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["rin1"]).Sum(item => Math.Round(item.LineTotal, 2));

            gdvrin1.CancelEdit();
            gdvrin1.DataSource = ((List <BEDocumentLine>)Session["rin1"]);
            gdvrin1.DataBind();
        }
Ejemplo n.º 16
0
        private string Payment()
        {
            var obec = ((BEParameters)Session["InitPar"]);
            var obrd = new BRDocument();
            var obj  = new BEDocument();

            obj.Socied         = obec.Socied;
            obj.Comments       = rbtnType.Value.ToString();
            obj.DocEntry       = Convert.ToInt32(txtNroOperacion.Value);
            obj.TaxDate        = Convert.ToDateTime(txtdocDate1.Text);
            obj.DocDueDate     = Convert.ToDateTime(txtcloseDate1.Text);
            obj.DocDate        = Convert.ToDateTime(txtcreateDate1.Text);
            obj.CardCode       = bteCustomer.Text;
            obj.CardName       = txtCustomerName.Text.Trim();
            obj.CntctCode      = Convert.ToInt32(txtcontctCode1.Value);
            obj.Project        = cbbProyecto.Value.ToString();
            obj.Address2       = cbbMedioPago.Value.ToString();
            obj.Address        = cbbAddress.Text;
            obj.DocCur         = cbbDocCur.Value.ToString();
            obj.Active         = checkPagoCuenta.Value.ToString();
            obj.DiscSum        = Convert.ToDecimal(txtDocTotalCP.Text);
            obj.DiscPrcntTotal = Convert.ToDecimal(txtimportetotal.Text);
            obj.DpmAmnt        = Convert.ToDecimal(txtimportetotal2.Text);
            //obj.Project = ((BEParameters)Session["InitPar"]).Project;
            obj.Lineas      = ((List <BEDocument>)Session["tecn"]);
            obj.CuentasPago = ((List <BECuentasPago>)Session["rct4"]);

            var obep = new BEParameters()
            {
                Socied = obec.Socied
            };
            var olst = obrd.GET_CUENTAS_PAGO(obep);

            if (checkpagoefe.Value.ToString() == "Y")
            {
                olst.Where(i => i.Project == obec.Project).ToList().ForEach(item => {
                    if (cbbCurPagoEfe.Value.ToString() == item.ActCurr)
                    {
                        obj.CashAccount = item.AcctCode;
                    }
                });
                obj.MedPayment = "EF";
                obj.DocCur     = cbbCurPagoEfe.Value.ToString();
                obj.CashSum    = Convert.ToDecimal(txtSalEfe2.Value);
            }
            if (checkpagotar.Value.ToString() == "Y")
            {
                obj.MedPayment2 = "TC";
                obj.DocDate1    = Convert.ToDateTime(dteDocDateTarj.Text);
                var _stc = cbbCreditCard1.Value.ToString().Split('_');
                obj.CreditCard   = Convert.ToInt16(_stc[0]);
                obj.NumAtCard    = txtNumOperacion.Text;
                obj.CashAccount2 = _stc[1];
                obj.CashSum2     = Convert.ToDecimal(txtSalTar2.Value);
                var _ccn = ("0000000000000" + txtNumTarjeta.Text);
                obj.DocCur2          = cbbCurPagoTar.Value.ToString();
                obj.CreditCardNumber = Right(_ccn, 13);
                obj.VoucherNum       = txtNumTarjeta.Text;
            }
            if (checkpagotrans.Value.ToString() == "Y")
            {
                obj.MedPayment3  = "TR";
                obj.DocCur3      = cbbCurPagoTrans.Value.ToString();
                obj.CashAccount3 = cbbCuentaTrans.Value.ToString();;
                obj.CashSum3     = Convert.ToDecimal(txtSalTrans2.Value);
                obj.DocDate3     = Convert.ToDateTime(dteDocDateTrans.Text);
                obj.NumAtCard3   = txtNumOperacion2.Text;
            }
            obrd.SavePayment2(obj, ((BEParameters)Session["InitPar"]).objSapSbo);

            var _err = !string.IsNullOrWhiteSpace(obj.Msg) ? obj.Msg : string.Format("OKBP#{0}#{1}", obj.DocNum, obj.DocEntry);

            return(_err);
        }