Exemplo n.º 1
0
        private void add_gastos()
        {
            GridViewRow row;

            for (int i = 0; i < gr_dato.Rows.Count; i++)
            {
                row = gr_dato.Rows[i];
                CheckBox chk          = (CheckBox)gr_dato.Rows[i].FindControl("chk");
                string   id_tipogasto = this.gr_dato.Rows[i].Cells[1].Text;
                string   chkgc        = ((CheckBox)gr_dato.Rows[i].FindControl("chkgc")).Checked.ToString();

                if (chk.Checked == true)
                {
                    TextBox txt           = (TextBox)gr_dato.Rows[i].FindControl("txt_valor_gasto");
                    TextBox txt_ccliente  = (TextBox)gr_dato.Rows[i].FindControl("txt_cargo_cliente");
                    TextBox txt_cempresa  = (TextBox)gr_dato.Rows[i].FindControl("txt_cargo_empresa");
                    Int32   montogasto    = Convert.ToInt32(txt.Text.ToString());
                    Int32   cargo_cliente = Convert.ToInt32(txt_ccliente.Text.ToString());
                    Int32   cargo_empresa = Convert.ToInt32(txt_cempresa.Text.ToString());
                    string  add           = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(id_solicitud), Convert.ToInt16(id_tipogasto), montogasto, (string)(Session["usrname"]), cargo_cliente, cargo_empresa, chkgc);
                }
                else
                {
                    Usuario usu = new UsuarioBC().GetUsuario((string)(Session["usrname"]));

                    if (usu.UserName.Trim() == "116333627" || usu.UserName.Trim() == "153636613" || usu.UserName.Trim() == "141548085" || usu.UserName.Trim() == "118550129" || usu.UserName.Trim() == "153944601" || usu.UserName.Trim() == "17483833k")
                    {
                        string add = new GastooperacionBC().del_gastooperacion(Convert.ToInt32(id_solicitud), Convert.ToInt16(id_tipogasto), chkgc, (string)(Session["usrname"]));
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void add_gastos()
        {
            GridViewRow row;

            for (int i = 0; i < gr_dato.Rows.Count; i++)
            {
                row = gr_dato.Rows[i];
                CheckBox chk          = (CheckBox)gr_dato.Rows[i].FindControl("chk");
                string   id_tipogasto = this.gr_dato.Rows[i].Cells[1].Text;
                string   chkgc        = ((CheckBox)gr_dato.Rows[i].FindControl("chkgc")).Checked.ToString();

                if (chk.Checked == true)
                {
                    TextBox txt           = (TextBox)gr_dato.Rows[i].FindControl("txt_valor_gasto");
                    TextBox txt_ccliente  = (TextBox)gr_dato.Rows[i].FindControl("txt_cargo_cliente");
                    TextBox txt_cempresa  = (TextBox)gr_dato.Rows[i].FindControl("txt_cargo_empresa");
                    double  montogasto    = Convert.ToDouble(txt.Text.ToString());
                    double  cargo_cliente = Convert.ToDouble(txt_ccliente.Text.ToString());
                    double  cargo_empresa = Convert.ToDouble(txt_cempresa.Text.ToString());
                    string  add           = new GastoOperacionPeruBC().AddGastoOperacion(Convert.ToInt32(id_solicitud), Convert.ToInt16(id_tipogasto), montogasto, (string)(Session["usrname"]), cargo_cliente, cargo_empresa, chkgc);
                }
                else
                {
                    string add = new GastooperacionBC().del_gastooperacion(Convert.ToInt32(id_solicitud), Convert.ToInt16(id_tipogasto), chkgc, (string)(Session["usrname"]));
                }
            }
        }
Exemplo n.º 3
0
        protected void getgastos()
        {
            //ClienteTag lClientetag = new ClienteTagBC().getclientetag(Convert.ToInt16(dl_cliente.SelectedValue.ToString()), 1);

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Gasto"));
            dt.Columns.Add(new DataColumn("Codigo"));
            DataColumn colhabilitado = new DataColumn("chk");

            colhabilitado.DataType = System.Type.GetType("System.Boolean");
            dt.Columns.Add(colhabilitado);
            //dt.Columns.Add(new DataColumn("check"));
            dt.Columns.Add(new DataColumn("monto"));
            DataColumn chkgchabilitado = new DataColumn("chkgc");

            chkgchabilitado.DataType = System.Type.GetType("System.Boolean");
            dt.Columns.Add(chkgchabilitado);



            List <GastoOperacion> lgasto = new GastooperacionBC().Getgastooperacion(Convert.ToInt32(this.lbl_numero.Text));

            foreach (GastoOperacion mcliente in lgasto)
            {
                DataRow dr = dt.NewRow();



                dr["Gasto"] = mcliente.Tipogasto.Descripcion;

                dr["chk"] = mcliente.Opcional;

                dr["monto"]  = mcliente.Monto;
                dr["Codigo"] = mcliente.Tipogasto.Id_tipogasto;
                dr["chkgc"]  = mcliente.Tipogasto.Check;

                if (Convert.ToBoolean(mcliente.Opcional) == false)
                {
                    colhabilitado.ReadOnly = true;
                }
                ;



                dt.Rows.Add(dr);



                this.gr_dato.DataSource = dt;
                this.gr_dato.DataBind();
                Total_general();
            }
        }
Exemplo n.º 4
0
        private void Add_Gasto_Completo()
        {
            var query = from r in this.gr_dato.Rows.OfType <GridViewRow>()
                        where ((CheckBox)r.FindControl("chk")).Checked == true && r.RowType == DataControlRowType.DataRow && Convert.ToDouble(Convert.ToDouble(this.gr_dato.DataKeys[r.RowIndex].Values[5])) == 0
                        select r.RowIndex;
            string add;

            foreach (int i in query)
            {
                foreach (GastoOperacion gasto in new GastooperacionBC().Getgastooperacion(Convert.ToInt32(this.gr_dato.DataKeys[i].Values[3].ToString())))
                {
                    add = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.gr_dato.DataKeys[i].Values[3].ToString()), gasto.Tipogasto.Id_tipogasto, gasto.Monto, (string)(Session["usrname"]), gasto.Cargo_cliente, gasto.Cargo_empresa, gasto.Tipogasto.Check.ToString());
                }
            }

            FuncionGlobal.alerta_updatepanel("Gastos ingresados con exito", this.Page, this.up_movimiento);
            this.Busca_Operacion();
        }
Exemplo n.º 5
0
        public void getGasto()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("id_tipogasto"));
            dt.Columns.Add(new DataColumn("descripcion"));
            dt.Columns.Add(new DataColumn("valor"));

            DataColumn coll = new DataColumn("checkgc");
            DataColumn col  = new DataColumn("check");

            col.DataType  = System.Type.GetType("System.Boolean");
            coll.DataType = System.Type.GetType("System.Boolean");

            dt.Columns.Add(col);
            dt.Columns.Add(coll);

            List <GastoOperacion> lgasto = new GastooperacionBC().Getgastooperacionmov(Convert.ToInt32(id_solicitud), tipo_movimiento);

            if (lgasto.Count > 0)
            {
                this.bt_guardar.Visible = true;
            }

            foreach (GastoOperacion mgasto in lgasto)
            {
                DataRow dr = dt.NewRow();

                dr["checkgc"]      = mgasto.Tipogasto.Check;
                dr["id_tipogasto"] = mgasto.Tipogasto.Id_tipogasto;
                dr["descripcion"]  = mgasto.Tipogasto.Descripcion;
                dr["valor"]        = mgasto.Monto;
                dr["check"]        = mgasto.Check;

                dt.Rows.Add(dr);
            }

            this.gr_dato.DataSource = dt;
            this.gr_dato.DataBind();

            Total_general();
            getMovimiento();
        }
Exemplo n.º 6
0
        protected void GenerarWB()
        {
            GridViewRow  row;
            MemoryStream m = new MemoryStream();

            XmlTextWriter xml = new XmlTextWriter(m, System.Text.Encoding.UTF8);

            xml.Formatting = Formatting.Indented;
            xml.Namespaces = true;
            xml.WriteStartDocument(false);
            xml.WriteStartElement("Root");
            string        folio   = "";
            string        familia = "";
            TipoNomina    nom     = new TipoNominaBC().getTiponominaBytipo(Convert.ToInt32(this.dl_tiponomina.SelectedValue));
            GastosComunes gasto   = new GastosComunesBC().getGastosComunes(Convert.ToInt32(nom.Id_tipogasto));

            Usuario muser = new UsuarioBC().GetUsuario((string)(Session["usrname"]));


            int nline = 10000;

            for (int i = 0; i < gr_dato.Rows.Count; i++)
            {
                row = gr_dato.Rows[i];

                string id_solicitud = this.gr_dato.DataKeys[i].Values[0].ToString();
                folio   = this.gr_dato.DataKeys[i].Values[1].ToString();
                familia = this.gr_dato.DataKeys[i].Values[2].ToString();


                List <GastoOperacion> lgasto = new GastooperacionBC().validacionGasto(Convert.ToInt32(id_solicitud));

                if (lgasto.Count() != 0)
                {
                    foreach (GastoOperacion mgasto in lgasto)
                    {
                        xml.WriteStartElement("GenJournalLine");
                        xml.WriteElementString("Libro", "GENERAL");
                        xml.WriteElementString("Seccion", "GENERICO");
                        xml.WriteElementString("LineNo", nline.ToString());
                        xml.WriteElementString("DocumentNo", "1505");
                        xml.WriteElementString("AccountType", "G/L Account");
                        xml.WriteElementString("AccountNo", mgasto.Cuenta_facturacion.ToString().Trim()); //cuenta_gasto
                        xml.WriteElementString("PostingDate", DateTime.Now.ToString("dd-MM-yy"));
                        xml.WriteElementString("Description", "INT Y REAJUSTES PERC.");
                        xml.WriteElementString("Importe", mgasto.Monto.ToString()); //valor_tramite
                        xml.WriteElementString("Nomina", folio);                    //folio
                        xml.WriteElementString("AreaCodigo", familia);
                        xml.WriteElementString("RutCodigo", muser.Usuanav.ToString());
                        xml.WriteElementString("RegionCodigo", "V");
                        xml.WriteElementString("Operacion", id_solicitud); //id_solicitud
                        xml.WriteElementString("CodterminosPago", "30DIAS");

                        xml.WriteEndElement();
                        nline = nline + 10000;
                    }
                }

                xml.WriteStartElement("GenJournalLine");
                xml.WriteElementString("Libro", "GENERAL");
                xml.WriteElementString("Seccion", "GENERICO");
                xml.WriteElementString("LineNo", nline.ToString());
                xml.WriteElementString("DocumentNo", "1505");
                xml.WriteElementString("AccountType", "G/L Account");
                xml.WriteElementString("AccountNo", gasto.Plandecuenta.Cuenta.ToString().Trim());    //cuenta_gasto
                xml.WriteElementString("PostingDate", DateTime.Now.ToString("dd-MM-yy"));
                xml.WriteElementString("Description", "INT Y REAJUSTES PERC.");
                xml.WriteElementString("Importe", gasto.Valor.ToString()); //valor_tramite
                xml.WriteElementString("Nomina", folio);                   //folio
                xml.WriteElementString("AreaCodigo", familia);
                xml.WriteElementString("RutCodigo", muser.Usuanav.ToString());
                xml.WriteElementString("RegionCodigo", "V");
                xml.WriteElementString("Operacion", id_solicitud);    //id_solicitud
                xml.WriteElementString("CodterminosPago", "30DIAS");

                xml.WriteEndElement();
                nline = nline + 10000;
            }
            xml.WriteEndElement();
            xml.WriteEndDocument();
            xml.Flush();

            m.Position = 0;
            string r = new StreamReader(m).ReadToEnd();

            xml.Close();
            m.Close();

            string strPath = System.Configuration.ConfigurationManager.AppSettings["DIARIO_GENERAL"];

            string          path  = strPath + DateTime.Now.ToString("dd-MM-yy") + "-" + folio + "-" + familia + ".xml";
            XmlDataDocument xmDoc = new XmlDataDocument();

            xmDoc.LoadXml(r);
            xmDoc.Save(path);
        }
Exemplo n.º 7
0
        public void getGasto()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("id_tipogasto"));
            dt.Columns.Add(new DataColumn("descripcion"));
            dt.Columns.Add(new DataColumn("valor"));
            dt.Columns.Add(new DataColumn("cargo_cliente"));
            dt.Columns.Add(new DataColumn("cargo_empresa"));
            DataColumn col   = new DataColumn("check");
            DataColumn coll  = new DataColumn("checkgc");
            DataColumn colll = new DataColumn("bloqueo");

            col.DataType   = System.Type.GetType("System.Boolean");
            coll.DataType  = System.Type.GetType("System.Boolean");
            colll.DataType = System.Type.GetType("System.Boolean");

            dt.Columns.Add(col);
            dt.Columns.Add(coll);
            dt.Columns.Add(colll);

            List <GastoOperacion> lgasto = new GastooperacionBC().Getgastooperacion(Convert.ToInt32(id_solicitud));

            //getPagoByOperacionRequest id = new getPagoByOperacionRequest();
            //id.Body.IdOperacion = Convert.ToInt32(id_solicitud);



            if (lgasto.Count > 0)
            {
                this.bt_guardar.Visible = true;
            }

            foreach (GastoOperacion mgasto in lgasto)
            {
                DataRow dr = dt.NewRow();

                dr["checkgc"]      = mgasto.Tipogasto.Check;
                dr["id_tipogasto"] = mgasto.Tipogasto.Id_tipogasto;
                dr["descripcion"]  = mgasto.Tipogasto.Descripcion;

                if (mgasto.Tipogasto.Check == true && mgasto.Tipogasto.Id_tipogasto == 32)
                {
                    if (EMI.IdOperacion != 0)
                    {
                        dr["valor"] = EMI.total_pago;

                        Preinscripcion pre   = new PreinscripcionBC().GetpreinscripcionbyIdSolicitud(Convert.ToInt32(id_solicitud));
                        int            cargo = Convert.ToInt32(pre.Cargo_venta.Trim());

                        switch (cargo)
                        {
                        case 1:
                            dr["cargo_empresa"] = EMI.total_pago;
                            dr["cargo_cliente"] = 0;
                            break;

                        case 2:
                            dr["cargo_empresa"] = 0;
                            dr["cargo_cliente"] = EMI.total_pago;
                            break;

                        case 4:
                            dr["cargo_empresa"] = EMI.total_pago / 2;
                            dr["cargo_cliente"] = EMI.total_pago / 2;
                            break;

                        case 5:
                            dr["cargo_empresa"] = 0;
                            dr["cargo_cliente"] = EMI.total_pago;
                            break;

                        case 6:
                            dr["cargo_empresa"] = EMI.total_pago;
                            dr["cargo_cliente"] = 0;
                            break;
                        }



                        //--239
                    }
                    else
                    {
                        dr["valor"]         = mgasto.Monto;
                        dr["cargo_empresa"] = mgasto.Cargo_empresa;
                        dr["cargo_cliente"] = mgasto.Cargo_cliente;
                        FuncionGlobal.alerta_updatepanel("NO EXISTE EL PERMISO EN LA BASE DE PROVIDENCIA", this.Page, this.up_datos);
                    }
                }
                else
                {
                    dr["valor"]         = mgasto.Monto;
                    dr["cargo_empresa"] = mgasto.Cargo_empresa;
                    dr["cargo_cliente"] = mgasto.Cargo_cliente;
                }

                dr["check"]   = mgasto.Check;
                dr["bloqueo"] = mgasto.Bloqueo;
                dt.Rows.Add(dr);
            }
            this.gr_dato.DataSource = dt;
            this.gr_dato.DataBind();
            Total_general();
        }
Exemplo n.º 8
0
        protected void bt_guardar2_Click(object sender, EventArgs e)
        {
            if (this.lbl_numero.Text != "")
            {
                //string add_or = new  ClienteTagBC().addclientetagoperacion(Convert.ToInt32(add),52);
                GridViewRow row;

                for (int i = 0; i < gr_dato.Rows.Count; i++)
                {
                    row = gr_dato.Rows[i];
                    CheckBox chk   = (CheckBox)gr_dato.Rows[i].FindControl("chk");
                    CheckBox chkgc = (CheckBox)gr_dato.Rows[i].FindControl("chkgc");
                    //string montogasto = this.gr_dato.Rows[i].Cells[3].Text;
                    TextBox montogasto = (TextBox)gr_dato.Rows[i].FindControl("monto");
                    string  codigo1    = this.gr_dato.Rows[i].Cells[0].Text;
                    string  codigo2    = this.gr_dato.Rows[i].Cells[1].Text;
                    string  codigo3    = this.gr_dato.Rows[i].Cells[2].Text;
                    string  codigo4    = this.gr_dato.Rows[i].Cells[3].Text;


                    //	int id_cliente = id_cliente;

                    if (chk.Checked == true)
                    {
                        if (cargo_vta.Text == "6")
                        {
                            //string add_or = new ClienteTagBC().addclientetagoperacion(Convert.ToInt32(add), 52,Convert.ToInt32( montogasto));
                            //|| codigo1 == "26" || codigo1 == "32" || codigo1 == "31"
                            if ((codigo1 == "120" || codigo1 == "31" || codigo1 == "32") && chkgc.Checked == true)
                            {
                                string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), 0, Convert.ToInt32(montogasto.Text), chkgc.Checked.ToString());
                            }
                            else
                            {
                                if (chkgc.Checked == false)
                                {
                                    string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), 0, Convert.ToInt32(montogasto.Text), chkgc.Checked.ToString());
                                }
                                else
                                {
                                    string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), Convert.ToInt32(montogasto.Text), 0, chkgc.Checked.ToString());
                                }
                            }
                        }

                        if (cargo_vta.Text == "5")
                        //|| codigo1 == "26" || codigo1 == "32" || codigo1 == "31"
                        {
                            if ((codigo1 == "120" || codigo1 == "31" || codigo1 == "32") && chkgc.Checked == true)
                            {
                                string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), Convert.ToInt32(montogasto.Text), 0, chkgc.Checked.ToString());
                            }
                            else
                            {
                                if (chkgc.Checked == false)
                                {
                                    string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), Convert.ToInt32(montogasto.Text), 0, chkgc.Checked.ToString());
                                }
                                else
                                {
                                    string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), 0, Convert.ToInt32(montogasto.Text), chkgc.Checked.ToString());
                                }
                            }
                        }
                        if (cargo_vta.Text == "4")
                        {
                            Int32  monto_div = Convert.ToInt32(montogasto.Text) / 2;
                            string add_or    = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), monto_div, monto_div, chkgc.Checked.ToString());
                        }
                        if (cargo_vta.Text == "1")
                        {
                            string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), 0, Convert.ToInt32(montogasto.Text), chkgc.Checked.ToString());
                        }
                        if (cargo_vta.Text == "2")
                        {
                            string add_or = new GastooperacionBC().add_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), Convert.ToInt32(montogasto.Text), (string)(Session["usrname"]), Convert.ToInt32(montogasto.Text), 0, chkgc.Checked.ToString());
                        }
                    }

                    else
                    {
                        //string add_or = new ClienteTagBC().delclientetagoperacion(Convert.ToInt32(add), 52);
                        string add_or = new GastooperacionBC().del_gastooperacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(codigo1), chkgc.Checked.ToString(), (string)(Session["usrname"]));
                    }
                }

                //Familia_Producto mfamilia1 = new Familia_productoBC().getfamiliabycodigo(tipo_operacion);
                //string addcom_or = new GastooperacionBC().add_gastooperacioncomunes(Convert.ToInt32(add), (string)(Session["usrname"]),tipo_operacion,Convert.ToInt16(id_cliente),Convert.ToInt16(mfamilia1.Id_familia.ToString()),Convert.ToInt16(this.dl_cargo_venta.SelectedValue));
            }
            pnl_ingreso_riesgo.Visible = false;
        }