Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (this.txt_fecha_movimiento.Text == "" || this.txt_monto.Text == "" || this.dl_tipo.SelectedValue == "0" || this.dl_cuenta.SelectedValue == "0")
            {
                FuncionGlobal.alerta("INGRESE LOS DATOS CORRESPONDIENTES", Page);
                return;
            }

            string add = new Movimiento_Cta_CteBC().add_Cta_Cte(Convert.ToInt32(this.dl_cuenta.SelectedValue),
                                                                Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_monto.Text)), this.dl_tipo.SelectedValue,
                                                                Convert.ToDateTime(this.txt_fecha_movimiento.Text),
                                                                (string)Session["usrname"]);

            FuncionGlobal.alerta("MOVIMIENTO REALIZADO CON EXITO", Page);
            this.txt_monto.Text            = "";
            this.txt_fecha_movimiento.Text = "";
            getCta_Cte();
        }
Ejemplo n.º 2
0
        protected void Add_Operacion()
        {
            if (!this.Validar_Form())
            {
                return;
            }

            UpdatePanel up = (UpdatePanel)this.Parent;

            if (!this.agp_consignatario.Guardar_Form())
            {
                ScriptManager.RegisterStartupScript(up, up.GetType(), "alert_adquirente", string.Format("alert('{0}');", this.agp_consignatario.MensajeError), true);
                return;
            }

            Int32  id_solicitud                   = Convert.ToInt32(ViewState["id_solicitud"]);
            double Adquiriente                    = this.agp_consignatario.Rut;
            short  cliente                        = Convert.ToInt16(ViewState["id_cliente"]);
            double compra_para                    = 0;
            string creada                         = "";
            double compra_repre                   = 0;
            double repertorio                     = 0;
            double n_factura                      = 0;
            string fecha_factura                  = "";
            short  id_sucursal                    = Convert.ToInt16(this.dl_sucursal.SelectedValue);
            double emisor                         = 0;
            double monto                          = 0;
            double n_cuotas                       = 0;
            string fecha_primera                  = "";
            string fecha_ultima                   = "";
            string cta_corriente                  = "";
            string banco                          = "";
            string titular                        = "";
            string notario                        = "";
            string ciudad                         = "";
            string fecha_contrato                 = "";
            double n_cheques                      = 0;
            double neto_factura                   = 0;
            string tipo_pago_factura              = "0";
            double factura_intereses              = 0;
            string fecha_factura_intereses        = "";
            double monto_factura_intereses        = 0;
            string fecha_protocolizacion          = "";
            string n_protocolizacion              = "0";
            string n_RepertorioNotaria            = "";
            string n_RepertorioRNP                = (this.txt_repertorio_rnp.Text.Replace(ViewState["separadorMiles"].ToString(), ""));
            string fecha_repertorio               = "";
            string oficina_Registro               = "";
            string ing_alza_PN_registro           = "";
            string ing_alza_PH_registro           = "";
            string n_solicitud_PN_registro        = "";
            string n_solicitud_PH_registro        = "";
            string nombreEstado                   = "";
            string fechaUltimoEstado              = "";
            double valor_vehiculo                 = 0;
            double monto_pie                      = 0;
            double factura_gastos                 = 0;
            string fecha_factura_gastos           = "";
            double monto_factura_gastos           = 0;
            double nro_credito                    = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_nro_credito.Text));
            string doc_fundante                   = "0";
            string solicitante                    = "";
            string notaria_protocolizacion        = "";
            string ciudad_notaria_protocolizacion = "";
            string fecha_repertorio_rnp           = this.txt_fecha_repertorio_rnp.Text;
            string estado_solicitud_rnp           = "0";
            string estado_prenda                  = "0";
            string observaciones                  = "";
            string nro_declaracion                = "";
            string fecha_pagare                   = "";
            int    valor_cuotas                   = 0;
            string tasa           = "0";
            int    dia            = 0;
            int    capital_pagare = 0;

            int add = new OperacionBC().add_operacion(id_solicitud, cliente, ViewState["tipo_operacion"].ToString(), (string)(Session["usrname"]), 0, "", Convert.ToInt32(this.dl_sucursal.SelectedValue), 0);

            ViewState["id_solicitud"] = add.ToString();

            if (add != 0)
            {
                string output = new GarantiaBC().add_Garantia(add, Adquiriente, cliente, compra_para, creada, compra_repre, repertorio, n_factura, fecha_factura, id_sucursal,
                                                              emisor, monto, n_cuotas, fecha_primera, fecha_ultima, cta_corriente, banco, titular, notario, ciudad, fecha_contrato, n_cheques,
                                                              neto_factura, tipo_pago_factura, factura_intereses, fecha_factura_intereses, monto_factura_intereses, fecha_protocolizacion, n_protocolizacion, n_RepertorioNotaria,
                                                              n_RepertorioRNP, fecha_repertorio, oficina_Registro, ing_alza_PN_registro, ing_alza_PH_registro, n_solicitud_PN_registro, n_solicitud_PH_registro, nombreEstado,
                                                              fechaUltimoEstado, valor_vehiculo, monto_pie, factura_gastos, fecha_factura_gastos, monto_factura_gastos, nro_credito, doc_fundante, solicitante,
                                                              notaria_protocolizacion, ciudad_notaria_protocolizacion, fecha_repertorio_rnp, estado_solicitud_rnp, estado_prenda, observaciones, false, nro_declaracion, fecha_pagare,
                                                              valor_cuotas, capital_pagare, tasa, dia);
                //Si hay un error guardando la operación
                if (output != "")
                {
                    ScriptManager.RegisterStartupScript(up, up.GetType(), "alert_add_garantia", string.Format("alert('{0}');", output), true);
                    return;
                }

                //PARA ORDEN DE TRABAJO
                if (IdOrdenTrabajo != 0)
                {
                    FuncionGlobal.UpdateTipoOperacionOrdenTrabajo(ViewState["tipo_operacion"].ToString(), IdOrdenTrabajo, add);
                }

                string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(add), 1, ViewState["tipo_operacion"].ToString(), "", (string)(Session["usrname"]));                //INGRESO OPERACIÓN

                if (!this.agp_vehiculo.Guardar_Form(add))
                {
                    ScriptManager.RegisterStartupScript(up, up.GetType(), "alert_add_garantia", string.Format("alert('{0}');", this.agp_vehiculo.MensajeError), true);
                    return;
                }

                this.lbl_operacion.Visible = true;
                this.lbl_numero.Visible    = true;

                this.lbl_numero.Text = add.ToString("N0");

                this.Busca_Operacion();
            }
        }
Ejemplo n.º 3
0
        protected void add_operacion()
        {
            string rutvend   = "0";
            int    operacion = 0;

            if (this.Datosvendedor.Guardar_Form())
            {
                if (this.Datosvendedor.InfoPersona != null)
                {
                    rutvend = this.Datosvendedor.InfoPersona.Rut.ToString();
                }
            }
            if (this.lbl_numero.Text != "")
            {
                operacion = Convert.ToInt32(this.lbl_numero.Text);
            }

            string interno = "";

            if (tipo_operacion.Trim() == "ctag" || tipo_operacion.Trim() == "dtag")
            {
                interno = this.dl_Codigo_TAG.SelectedValue;
            }
            else
            {
                interno = this.txt_interno.Text.Trim();
            }

            int fac = 0;

            if (txt_factura.Text.Trim() != "")
            {
                fac = Convert.ToInt32(txt_factura.Text.Trim());
            }


            Int32 add = new OperacionBC().add_operacion(operacion, Convert.ToInt16(this.dl_cliente.SelectedValue),
                                                        tipo_operacion, (string)(Session["usrname"]), 0, interno,
                                                        Convert.ToInt32(this.dl_sucursal_origen.SelectedValue), fac, this.txt_observacion.Text);

            string addparven = new ParticipeOperacionBC().add_participe(Convert.ToInt32(add), Convert.ToInt32(this.Datosvendedor.InfoPersona.Rut), "COMPR");

            DatosVehiculo mdato2           = new DatosVehiculo();
            Int32         id_dato_vehiculo = 0;

            mdato2 = new DatosvehiculoBC().getDatovehiculo(operacion);

            Marcavehiculo marca       = new Marcavehiculo();
            Tipovehiculo  tipvehi     = new Tipovehiculo();
            string        mar         = this.dl_marca.SelectedValue;
            string        tip         = this.dl_tipo_vehiculo.SelectedValue;
            string        anno        = "0";
            string        kilometraje = "0";

            if (this.txt_ano.Text != "")
            {
                anno = this.txt_ano.Text;
            }
            if (this.txt_kilometraje.Text != "")
            {
                kilometraje = this.txt_kilometraje.Text;
            }
            if (mar != "0")
            {
                marca = new MarcavehiculoBC().getmarcavehiculo(Convert.ToInt16(mar));
            }
            else
            {
                marca = new MarcavehiculoBC().getmarcavehiculo(69);
            }
            if (tip != "0")
            {
                tipvehi = new TipovehiculoBC().getTipoVehiculo(tip);
            }
            else
            {
                tipvehi = new TipovehiculoBC().getTipoVehiculo("PDF");
            }



            if (mdato2 != null)
            {
                if (mdato2.Id_solicitud == add)
                {
                    id_dato_vehiculo = mdato2.Id_dato_vehiculo;
                }

                string datovehi = new DatosvehiculoBC().add_Datosvehiculo(add,
                                                                          marca,
                                                                          tipvehi,
                                                                          txt_patente.Text,
                                                                          FuncionGlobal.digitoVerificadorPatente(txt_patente.Text),
                                                                          mdato2.Modelo, mdato2.Chassis, this.txt_motor.Text, mdato2.Vin, mdato2.Serie, Convert.ToInt32(anno), "", mdato2.Color, 0, 0, "", 0, 0,
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(kilometraje)), Convert.ToInt32(0),
                                                                          "", Convert.ToInt32(0),
                                                                          id_dato_vehiculo, DateTime.Now, "", "false", "", 0, "false", mdato2.Transmision, mdato2.Equipamiento, "0");
            }
            else
            {
                string datovehi = new DatosvehiculoBC().add_Datosvehiculo(add,
                                                                          marca,
                                                                          tipvehi,
                                                                          this.txt_patente.Text,
                                                                          FuncionGlobal.digitoVerificadorPatente(txt_patente.Text),
                                                                          "", "", this.txt_motor.Text, "", "", Convert.ToInt32(anno), "", "", 0, 0, "", 0, 0,
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(kilometraje)),
                                                                          Convert.ToInt32(0),
                                                                          "", Convert.ToInt32(0), id_dato_vehiculo, DateTime.Now,
                                                                          "", "false", "", 0, "0", "0", "0", "0");
            }

            string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(add), 1, tipo_operacion, "", (string)(Session["usrname"]));


            this.lbl_operacion.Visible = true;
            this.lbl_numero.Visible    = true;
            this.lbl_operacion.Text    = "Operación Numero:";
            this.lbl_numero.Text       = Convert.ToString(add);
            FuncionGlobal.alerta(this.lbl_titulo.Text + ", INGRESADO CON EXITO", Page);
        }
Ejemplo n.º 4
0
        private void add_datosvehiculo()
        {
            DateTime fecha        = Convert.ToDateTime("01/01/1900");
            Int32    precio       = 0;
            Int32    kilometraje  = 0;
            Int32    cantidad     = 0;
            Int32    valor_cesion = 0;
            Int32    valor_opcion = 0;
            Int32    contrato     = 0;
            Int32    impuesto     = 0;

            string forma_pago = "";


            impuesto = Convert.ToInt32(this.dl_impuesto.SelectedValue);


            string mstock = new StockVentasBC().act_stockventaImp(Convert.ToInt32(id_solicitud), impuesto);


            string        dv    = FuncionGlobal.digitoVerificadorPatente(patente);
            DatosVehiculo mdato = new DatosvehiculoBC().getDatovehiculobyPatente_id_solicitud(patente, Convert.ToInt32(this.id_solicitud));

            if (this.txt_fecha_contrato.Text != "")
            {
                fecha = Convert.ToDateTime(this.txt_fecha_contrato.Text);
            }

            if (this.txt_forma_pago.Text != "")
            {
                forma_pago = this.txt_forma_pago.Text;
            }

            if (this.txt_precio_venta.Text != "")
            {
                precio = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_precio_venta.Text));
            }

            if (this.txt_kilometraje.Text != "")
            {
                kilometraje = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_kilometraje.Text));
            }


            Int32 rut_prenda = 0;


            if (this.chk_prenda.Checked == true)
            {
                if (this.Datosprendedor.Guardar_Form())
                {
                    if (this.Datosprendedor.InfoPersona != null)
                    {
                        rut_prenda = Convert.ToInt32(this.Datosprendedor.InfoPersona.Rut.ToString());
                    }
                }
            }
            else
            {
                precio = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_precio_venta.Text));
            }

            Marcavehiculo marca = new MarcavehiculoBC().getmarcavehiculo(Convert.ToInt16(mdato.Marca.Id_marca));
            Tipovehiculo  vehi  = new TipovehiculoBC().getTipoVehiculo(mdato.Tipo_vehiculo.Codigo);

            string add = new DatosvehiculoBC().add_Datosvehiculo(Convert.ToInt32(this.id_solicitud), marca,
                                                                 vehi, this.patente, dv, mdato.Modelo, mdato.Chassis
                                                                 , mdato.Motor, mdato.Vin,
                                                                 mdato.Serie, mdato.Ano, mdato.Cilindraje, mdato.Color,
                                                                 mdato.Carga, mdato.Pesobruto, mdato.Combustible, mdato.Npuerta,
                                                                 mdato.Nasiento, kilometraje, mdato.Tasacion, mdato.Codigo_SII,
                                                                 precio, mdato.Id_dato_vehiculo, fecha, forma_pago, chk_prenda.Checked.ToString().Trim(),
                                                                 mdato.Estado_vehiculo, rut_prenda, mdato.Financiamiento_amicar, mdato.Transmision, mdato.Equipamiento);

            int n_cheques = 0;

            if (int.TryParse(this.txt_cheques.Text, out n_cheques))
            {
                ChequesFormaPagoBC cheques = new ChequesFormaPagoBC();

                cheques.del_cheques_operacion(Convert.ToInt32(this.id_solicitud));

                for (int i = 0; i < this.gr_cheques.Rows.Count; i++)
                {
                    int      id_cheque    = Convert.ToInt32(this.gr_cheques.Rows[i].Cells[0].Text);
                    int      nro_cheque   = Convert.ToInt32(((TextBox)this.gr_cheques.Rows[i].FindControl("txt_nro_cheque")).Text);
                    DateTime fecha_cheque = Convert.ToDateTime(((TextBox)this.gr_cheques.Rows[i].FindControl("txt_fecha_cheque")).Text);
                    int      monto_cheque = Convert.ToInt32(((TextBox)this.gr_cheques.Rows[i].FindControl("txt_monto_cheque")).Text);
                    cheques.add_cheques_operacion(id_cheque, Convert.ToInt32(this.id_solicitud), nro_cheque, fecha_cheque, monto_cheque, this.dl_financiera.SelectedValue, "");
                }

                cheques = null;
            }

            if (Panel2.Visible == true)
            {
                DateTime fecha_cesion = Convert.ToDateTime(this.txt_fecha_cesion.Text);

                if (this.txt_cantidad.Text != "" && Convert.ToInt16(this.txt_cantidad.Text) > 0)
                {
                    cantidad = Convert.ToInt16(FuncionGlobal.NumeroSinFormato(this.txt_cantidad.Text));
                }
                if (this.txt_valor_cesion.Text != "")
                //if (this.txt_valor_cesion.Text != ""&& Convert.ToUInt16(this.txt_valor_cesion.Text) > 0)
                {
                    valor_cesion = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_valor_cesion.Text));
                }

                if (this.txt_valor_opcion.Text != "")
                //if (this.txt_valor_opcion.Text != "" && Convert.ToInt32(this.txt_valor_opcion.Text) > 0)
                {
                    valor_opcion = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_valor_opcion.Text));
                }
                if (this.txt_contrato.Text != "")
                //if (this.txt_contrato.Text != "" && Convert.ToInt32(this.txt_contrato.Text) >0)
                {
                    contrato = Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_contrato.Text));
                }

                string addleasing = new Leasing_transferenciaBC().add_leasing(Convert.ToInt32(this.id_solicitud), patente, contrato, fecha_cesion, valor_opcion, valor_cesion, cantidad);
            }

            UpdatePanel up = (UpdatePanel)this.Master.FindControl("UpdatePanel1");

            FuncionGlobal.alerta_updatepanel("DATOS DEL VEHICULO ACTUALIZADOS CON EXITO", this.Page, up);
            this.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CloseWnd", "<script type=\"text/javascript\">window.close();</script>");
            return;
        }
Ejemplo n.º 5
0
        private void add()
        {
            string rutcomp        = "0";
            string rutvend        = "0";
            string rutcompp       = "0";
            string financiamiento = "0";


            UpdatePanel        up         = (UpdatePanel)this.Master.FindControl("UpdatePanel1");
            double             rut2       = this.Datoscomprador.getRut();
            List <Direcciones> ldireccion = new DireccionesBC().getdirecciones(Convert.ToInt32(rut2));

            if (this.dl_forma_pago.SelectedValue == "2" & this.dl_financiera.SelectedValue == "0")
            {
                FuncionGlobal.alerta_updatepanel("Debe seleccionar un banco o financiera", Page, up);
                return;
            }

            if (id_cliente == 3 || id_cliente == 4)
            {
                if (tipo_operacion == "CVT")
                {
                    if (this.dl_forma_pago.SelectedValue == "0")
                    {
                        FuncionGlobal.alerta_updatepanel("Debe seleccionar forma de pago", Page, up);
                        return;
                    }
                }
            }



            if (vent == "CTC" || vent == "CTMAG")
            {
                Cliente mcliente = new ClienteBC().getclienteusuario(this.Datoscomprador.getRut(), (string)(Session["usrname"]));
                if (vent == "CTC" && mcliente.Check == true || vent == "CTMAG" && mcliente.Check == true)
                {
                    tipo_operacion = "CTM";
                }
                else
                {
                    if (vent == "CTC")
                    {
                        tipo_operacion = "CCV";
                    }
                    else
                    {
                        tipo_operacion = "CVEN";
                    }
                    if (ldireccion.Count == 0)
                    {
                        FuncionGlobal.alerta_updatepanel("El comprador no tiene direccion", Page, up);
                        return;
                    }
                }
            }

            if (tipo_operacion != "CTC" || tipo_operacion != "CTMAG")
            {
                if (this.Datoscomprador.Guardar_Form())
                {
                    if (this.Datoscomprador.InfoPersona != null)
                    {
                        rutcomp = this.Datoscomprador.InfoPersona.Rut.ToString();
                    }
                }
            }
            if (this.Datosvendedor.Guardar_Form())
            {
                if (this.Datosvendedor.InfoPersona != null)
                {
                    rutvend = this.Datosvendedor.InfoPersona.Rut.ToString();
                }
            }

            if (this.agpCompraPara.Guardar_Form())
            {
                if (this.agpCompraPara.InfoPersona != null)
                {
                    rutcompp = this.agpCompraPara.InfoPersona.Rut.ToString();
                }
            }

            int factura = 0;

            if (this.txtNumFactura.Text != "")
            {
                factura = Convert.ToInt32(txtNumFactura.Text);
            }

            Int32 add = new OperacionBC().add_operacion(Convert.ToInt32(this.lbl_numero.Text),
                                                        Convert.ToInt16(this.dl_cliente.SelectedValue), tipo_operacion,
                                                        (string)(Session["usrname"]), 0, this.txt_numero_emisor.Text.Trim(),
                                                        Convert.ToInt32(this.dl_sucursal_origen.SelectedValue), factura);

            if (tipo_operacion != "CVT")
            {
                this.id_solicitud = Convert.ToInt32(this.lbl_numero.Text);
            }
            else
            {
                if (this.lbl_numero.Visible == true)
                {
                    this.id_solicitud = Convert.ToInt32(this.lbl_numero.Text);
                }
            }

            if (chk_leasing.Checked == true)
            {
                string leasing = new Leasing_transferenciaBC().add_leasing(add,
                                                                           this.txt_patente.Text.Trim(),
                                                                           Convert.ToInt32(this.txt_n_contrato.Text),
                                                                           Convert.ToDateTime(this.txt_fecha_contrato.Text),
                                                                           Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_valor_opcion.Text)),
                                                                           Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_valor_cesion.Text)),
                                                                           Convert.ToInt32(this.txt_n_vehiculos.Text));
            }
            DatosVehiculo mdato = new DatosvehiculoBC().getDatovehiculobyPatente_id_solicitud(this.txt_patente.Text.Trim(), id_solicitud);
            //DatosVehiculo mdato = new DatosvehiculoBC().getDatovehiculobypatente(this.txt_patente.Text);

            Marcavehiculo marca            = new MarcavehiculoBC().getmarcavehiculo(69);
            Tipovehiculo  tipvehi          = new TipovehiculoBC().getTipoVehiculo("PDF");
            Int32         id_dato_vehiculo = 0;
            Int32         rut_prenda       = 0;

            if (mdato != null && id_solicitud != 0)
            {
                if (vent == "CTM")
                {
                    marca            = mdato.Marca;
                    tipvehi          = mdato.Tipo_vehiculo;
                    id_dato_vehiculo = 0;
                }
                else
                {
                    rut_prenda       = mdato.Rut_prenda;
                    id_dato_vehiculo = mdato.Id_dato_vehiculo;
                    marca            = mdato.Marca;
                    tipvehi          = mdato.Tipo_vehiculo;
                }
            }

            DatosVehiculo mdato2;

            if (id_dato_vehiculo != 0)
            {
                mdato2 = new DatosvehiculoBC().getDatovehiculobyPatente_id_solicitud(this.txt_patente.Text.Trim(), id_solicitud);
            }
            else
            {
                mdato2 = new DatosvehiculoBC().getDatovehiculobypatente(this.txt_patente.Text);
            }
            if (mdato2 != null)
            {
                string datovehi = new DatosvehiculoBC().add_Datosvehiculo(add,
                                                                          mdato2.Marca,
                                                                          mdato2.Tipo_vehiculo,
                                                                          txt_patente.Text,
                                                                          FuncionGlobal.digitoVerificadorPatente(txt_patente.Text),
                                                                          mdato2.Modelo, mdato2.Chassis, mdato2.Motor, mdato2.Vin, mdato2.Serie, Convert.ToInt32(mdato2.Ano), "", mdato2.Color, 0, 0, "", 0, 0,
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_kilometraje.Text)),
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_tasacion.Text)),
                                                                          lbl_codigo.Text, Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_precio.Text)),
                                                                          Convert.ToInt32(id_dato_vehiculo), DateTime.Now, "", "false", "", 0, financiamiento, mdato2.Transmision, mdato2.Equipamiento);
            }
            else
            {
                if (this.dl_marca_vehiculo.SelectedValue != "0")
                {
                    marca = new MarcavehiculoBC().getmarcavehiculo(Convert.ToInt16(this.dl_marca_vehiculo.SelectedValue));
                }
                if (this.dl_tipo_vehiculo.SelectedValue != "0")
                {
                    tipvehi = new TipovehiculoBC().getTipoVehiculo(this.dl_tipo_vehiculo.SelectedValue);
                }

                string datovehi = new DatosvehiculoBC().add_Datosvehiculo(add,
                                                                          marca,
                                                                          tipvehi,
                                                                          txt_patente.Text,
                                                                          FuncionGlobal.digitoVerificadorPatente(txt_patente.Text),
                                                                          this.txt_modelo.Text, this.txt_chassis.Text, this.txt_motor.Text, "", "", Convert.ToInt32(this.txt_anno.Text), "", this.txt_color.Text, 0, Convert.ToInt32(this.txt_p_bruto.Text), this.dl_combustible.SelectedValue, 0, 0,
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_kilometraje.Text)),
                                                                          Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_tasacion.Text)),
                                                                          lbl_codigo.Text, Convert.ToInt32(FuncionGlobal.NumeroSinFormato(txt_precio.Text)), id_dato_vehiculo, DateTime.Now,
                                                                          "", "false", "", 0, financiamiento.Trim(), this.dl_financiera.SelectedValue, "0", "0");
            }
            if (vent == "")
            {
                DatosVehiculo vehicu = new DatosvehiculoBC().getDatovehiculobyPatente_id_solicitud(this.txt_patente.Text, add);
                if (tipo_operacion == "CTMAG")
                {
                    string add_stock = new StockVentasBC().add_sotckventas(add, 0, "false", vehicu.Id_dato_vehiculo, false);
                }
                else
                {
                    string add_stock = new StockVentasBC().add_sotckventas(add, 0, "false", vehicu.Id_dato_vehiculo, true);
                }
            }
            else
            {
                DatosVehiculo vehicu = new DatosvehiculoBC().getDatovehiculo(id_solicitud);
                if (vent == "CTC" || vent == "CTMAG")
                {
                    Cliente mcliente = new ClienteBC().getclienteusuario(this.Datoscomprador.InfoPersona.Rut, (string)(Session["usrname"]));
                    if (vent == "CTC" && mcliente.Check == true || vent == "CTMAG")
                    {
                        string add_stock = new StockVentasBC().add_sotckventas(id_solicitud, add, "false", vehicu.Id_dato_vehiculo, true);
                    }
                    else
                    {
                        string add_stock = new StockVentasBC().add_sotckventas(id_solicitud, add, "true", vehicu.Id_dato_vehiculo, true);
                    }
                }
                else
                {
                    string add_stock = new StockVentasBC().add_sotckventas(id_solicitud, add, "true", vehicu.Id_dato_vehiculo, true);
                }
            }

            if (add != 0)
            {
                string add_TR = new TransferenciaBC().add_Transferencia(add,
                                                                        Convert.ToDouble(rutvend),
                                                                        Convert.ToDouble(rutcomp),
                                                                        Convert.ToDouble(rutcompp),
                                                                        Convert.ToInt32(this.dl_sucursal_origen.SelectedValue),
                                                                        this.dl_tag.SelectedValue,
                                                                        this.dl_financiera.SelectedValue,
                                                                        this.dl_forma_pago.SelectedValue
                                                                        );



                if (add_TR == "" && vent != "CTC" || vent != "CTMAG")
                {
                    string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(add), 1, tipo_operacion, "", (string)(Session["usrname"]));
                }
            }



            this.lbl_operacion.Visible = true;
            this.lbl_numero.Visible    = true;
            this.lbl_operacion.Text    = "Operación de Transferencia Numero:";
            this.lbl_numero.Text       = Convert.ToString(add);

            FuncionGlobal.alerta("CONTRATO DE TRANSFERENCIA, INGRESADO CON EXITO", Page);
        }
Ejemplo n.º 6
0
        private void add_operacion()
        {
            double      rut_deudor = 0;
            GridViewRow row;
            string      rutvend     = "0";
            Int32       monto_final = 0;
            DateTime    fecha       = Convert.ToDateTime("01/01/1900");

            if (this.Datosvendedor.Guardar_Form())
            {
                if (this.Datosvendedor.InfoPersona != null)
                {
                    rutvend = this.Datosvendedor.InfoPersona.Rut.ToString();
                }
            }

            if (this.txt_rut_deudor.Text == "")
            {
                rut_deudor = 0;
            }
            else
            {
                rut_deudor = Convert.ToDouble(this.txt_rut_deudor.Text);
                string persona = new PersonaBC().add_personaCG(Convert.ToDouble(this.txt_rut_deudor.Text),
                                                               this.txt_dv.Text,
                                                               1,
                                                               "",
                                                               this.txt_nombre_deudor.Text,
                                                               this.txt_paterno.Text,
                                                               this.txt_materno.Text,
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "0",
                                                               "0",
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "0");
            }



            Int32 add = new OperacionBC().add_operacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(id_cliente), "SGI", (string)(Session["usrname"]), 0, "", Convert.ToInt32(this.dl_sucursal_origen.SelectedValue), 0);

            if (this.txt_monto_final.Text != "")
            {
                monto_final = Convert.ToInt32(this.txt_monto_final.Text);
            }
            if (this.txt_fecha_gestion.Text != "")
            {
                fecha = Convert.ToDateTime(this.txt_fecha_gestion.Text);
            }
            string addI_CTG = new ControlGestionBC().add_controlgestion(add,
                                                                        Convert.ToInt32(this.txt_rut_deudor.Text),
                                                                        Convert.ToInt32(this.dl_producto_Cliente.SelectedValue),
                                                                        Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_total.Text)),
                                                                        fecha,
                                                                        Convert.ToInt32(this.txt_ncuotas.Text),
                                                                        this.txt_noperacion.Text, Convert.ToInt32(this.dl_sucursal_origen.SelectedValue.ToString()),
                                                                        this.txt_observacion.Text,
                                                                        Convert.ToInt32(this.dl_forma_pago.SelectedValue.ToString()),
                                                                        Convert.ToInt32(rutvend), this.txt_patente.Text, monto_final
                                                                        );



            string add_SGI = "";
            string del_SGI = "";

            if (add != 0)
            {
                del_SGI = new DatoContactoBC().del_DatoContacto(add);
                for (int i = 0; i < gr_dato.Rows.Count; i++)
                {
                    row = gr_dato.Rows[i];
                    TextBox txt_referencia = (TextBox)gr_dato.Rows[i].FindControl("txt_referencia");

                    add_SGI = new DatoContactoBC().add_DatoContacto(add,
                                                                    txt_referencia.Text
                                                                    );
                }

                if (add_SGI == "")
                {
                    string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(add), 1, "SGI", "", (string)(Session["usrname"]));
                }
            }
            this.lbl_operacion.Visible = true;
            this.lbl_numero.Visible    = true;
            this.ib_mas.Enabled        = true;
            this.lbl_operacion.Text    = "Operación de Gestion y Control Numero:";
            this.lbl_numero.Text       = Convert.ToString(add);
            getreferencia(Convert.ToString(add));
            //carga_rpt(add);
        }