Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         txtFecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
         bind.PutDatasIntoDropDownList(almacen, "SELECT palm_almacen,palm_descripcion FROM palmacen where (pcen_centcart is not null  or pcen_centteso is not null) and tvig_vigencia='V' order by palm_descripcion;");
         almacen.Items.Insert(0, "Seleccione:");
         if (Request.QueryString["prefD"] != null && Request.QueryString["numD"] != null)
         {
             Response.Write("<script language:javascript>alert('Se ha creado el documento " + Request.QueryString["prefD"] + "-" + Request.QueryString["numD"] + "');</script>");
             try
             {
                 formatoConsignacion         = new FormatosDocumentos();
                 formatoConsignacion.Prefijo = Request.QueryString["prefD"];
                 formatoConsignacion.Numero  = Convert.ToInt32(Request.QueryString["numD"]);
                 formatoConsignacion.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefD"] + "'");
                 if (formatoConsignacion.Codigo != string.Empty)
                 {
                     if (formatoConsignacion.Cargar_Formato())
                     {
                         Response.Write("<script language:javascript>w=window.open('" + formatoConsignacion.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                     }
                 }
             }
             catch
             {
                 lb.Text += "Error al generar la impresión. Detalles : " + formatoConsignacion.Mensajes + "<br>";
             }
         }
     }
 }
Exemplo n.º 2
0
        protected void ImprimirFormatoPDF()
        {
            string prefijo = Request.QueryString["pref"];
            string numero  = Request.QueryString["num"];

            Utils.MostrarAlerta(Response, "Se ha creado la devolución de la factura del proveedor con prefijo: " + prefijo + " y número: " + numero + "");

            formatoFactura = new FormatosDocumentos();
            try
            {
                formatoFactura.Prefijo = prefijo;
                formatoFactura.Numero  = Convert.ToInt32(numero);
                formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + prefijo + "'");

                if (formatoFactura.Codigo != string.Empty)
                {
                    if (formatoFactura.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                    }
                }
                formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + prefijo + "'");
                if (formatoFactura.Codigo != string.Empty)
                {
                    if (formatoFactura.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                    }
                }
            }
            catch
            {
                lb.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object Sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                bind.PutDatasIntoDropDownList(almacen, "SELECT palm_almacen,palm_descripcion FROM palmacen where (pcen_centcart is not null  or pcen_centteso is not null) and TVIG_VIGENCIA = 'V' order by palm_descripcion;");
                if (almacen.Items.Count > 1)
                {
                    almacen.Items.Insert(0, "Seleccione..");
                }

                bind.PutDatasIntoDropDownList(tipoConsignacion, "SELECT tcau_codigo,tcau_nombre FROM ttipoconsignacion WHERE tcau_codigo<>8");
                if (tipoConsignacion.Items.Count > 1)
                {
                    tipoConsignacion.Items.Insert(0, "Seleccione..");
                }

                //    bind.PutDatasIntoDropDownList(prefijoDocumento, "SELECT pdoc_codigo,pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='CS' and tvig_vigencia = 'V' ");
                else
                {
                    Cambiar_Accion(null, null);
                }
                holderConsignacionCC.Visible = holderDevolucionCC.Visible = holderRemisionFinanciera.Visible = holderDevolucionFinanciera.Visible = holderTrasladoCCCarta.Visible = holderTrasladoCCCheque.Visible = holderNotasBancarias.Visible = holderChequesProveedores.Visible = false;
                valorConsignado.Text         = totalEfectivo.Text = "$0.00";
                if (Request.QueryString["prefD"] != null && Request.QueryString["numD"] != null)
                {
                    Utils.MostrarAlerta(Response, "Se ha creado el documento " + Request.QueryString["prefD"] + "-" + Request.QueryString["numD"] + "");
                    try
                    {
                        formatoConsignacion         = new FormatosDocumentos();
                        formatoConsignacion.Prefijo = Request.QueryString["prefD"];
                        formatoConsignacion.Numero  = Convert.ToInt32(Request.QueryString["numD"]);
                        formatoConsignacion.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefD"] + "'");
                        if (formatoConsignacion.Codigo != string.Empty)
                        {
                            if (formatoConsignacion.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoConsignacion.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lb.Text += "Error al generar la impresión. Detalles : " + formatoConsignacion.Mensajes + "<br>";
                    }
                }
            }
            // este cargue solo debe aplicarlo unicamente al proceso seleccionado
            holderConsignacionCC.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.ConsignacionCC.ascx"));
            holderDevolucionCC.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.DevolucionCC.ascx"));
            holderRemisionFinanciera.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.RemCheqFinan.ascx"));
            holderDevolucionFinanciera.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.DevCheqFinan.ascx"));
            holderTrasladoCCCarta.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.TrasFondosCCCarta.ascx"));
            holderTrasladoCCCheque.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.TrasFondosCCCheque.ascx"));
            holderNotasBancarias.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.NotasBancarias.ascx"));
            holderChequesProveedores.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.EntrChequesProv.ascx"));
        }
Exemplo n.º 4
0
        protected void RealizarDevolucion(Object Sender, EventArgs e)
        {
            if (ddlVINDev.Items.Count == 0)
            {
                Utils.MostrarAlerta(Response, "No se ha seleccionado algun vehículo para devolver.\\nRevise Por Favor");
                return;
            }
            uint      numPDVeh        = 0;
            Recepcion recepcionNota   = new Recepcion();
            DateTime  fechaDevolucion = Convert.ToDateTime(tbDate.Text);

            string error = Recepcion.DevolverVehiculoProveedor(ddlVINDev.SelectedValue, ddlNotDevProv.SelectedValue, HttpContext.Current.User.Identity.Name, ref numPDVeh, txtobsv.Text, fechaDevolucion);

            if (error != "")
            {
                Utils.MostrarAlerta(Response, "" + (error.Split('*'))[0] + ".\\nRevise Por Favor");
                lb.Text += "<br>" + (error.Split('*'))[1];
            }
            else if (numPDVeh != 0)
            {
                string numeroNota = DBFunctions.SingleData("SELECT MFAC_NUMEORDEPAGO FROM MVEHICULO WHERE MVEH_INVENTARIO = " + ddlVINDev.SelectedValue.ToString() + " ");
                contaOnline.contabilizarOnline(ddlNotDevProv.SelectedValue.ToString(), Convert.ToInt32(numeroNota.ToString()), fechaDevolucion, "");

                // Mostrar el formato de la NOTA DE LA DEVOLUCION
                Utils.MostrarAlerta(Response, "Se ha creado la devolucion de la factura del proveedor con prefijo " + ddlNotDevProv.SelectedValue.ToString() + " y número " + numeroNota.ToString() + "");

                formatoFactura = new FormatosDocumentos();
                try
                {
                    formatoFactura.Prefijo = ddlNotDevProv.SelectedValue.ToString();
                    formatoFactura.Numero  = Convert.ToInt32(numeroNota.ToString());
                    formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlNotDevProv.SelectedValue.ToString() + "'");

                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                        }
                    }
                    formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlNotDevProv.SelectedValue.ToString() + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                        }
                    }
                }
                catch
                {
                    lb.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                }

                Response.Redirect("" + indexPage + "?process=Vehiculos.DevolucionPedidoProveedor&pref=" + ddlNotDevProv.SelectedValue + "&num=" + numeroNota);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                proceso = Request.QueryString["accion"]; //LEE el parametrs si es ELIMINACION para BORRAR de todo lado la factura
                ViewState["eliminar"] = proceso;
                DatasToControls bind = new DatasToControls();
                bind.PutDatasIntoDropDownList(prefijoPedidoOtro, string.Format(Documento.DOCUMENTOSTIPO, "PC"));
                if (prefijoPedidoOtro.Items.Count > 1)
                {
                    prefijoPedidoOtro.Items.Insert(0, "Seleccione:..");
                }
                else
                {
                    bind.PutDatasIntoDropDownList(numeroPedidoOtro,
                                                  @"SELECT MPV.mped_numepedi  
					 FROM mpedidovehiculo MPV, masignacionvehiculo MAV, mvehiculo MVH  
					 WHERE MPV.test_tipoesta=30 AND MPV.pdoc_codigo='"                     + prefijoPedidoOtro.SelectedValue + @"' AND MAV.pdoc_codigo=MPV.pdoc_codigo AND MAV.mped_numepedi = MPV.mped_numepedi AND MAV.mveh_inventario = MVH.mveh_inventario AND MVH.test_tipoesta = 40  
					 ORDER BY MPV.mped_numepedi;"                    );
                }
                bind.PutDatasIntoDropDownList(prefijoDevoluciones, "SELECT p.pdoc_codigo, p.pdoc_codigo CONCAT ' - ' CONCAT p.pdoc_nombre FROM pdocumento as P, pdocumentohecho as PH WHERE p.tdoc_tipodocu = 'NC' and PH.tpro_proceso in ('VN','VU') AND P.PDOC_CODIGO = PH.PDOC_CODIGO and pdoc_numefina > pdoc_numeinic and pdoc_ultidocu < pdoc_numefina");
                if (prefijoDevoluciones.Items.Count == 0)
                {
                    Utils.MostrarAlerta(Response, "No se ha configurado el prefijo para las devoluciones de factura cliente. Revise Por Favor.");
                }
                string notaAcceDescrip = "";
                if (Request.QueryString["prefNotaAcce"] != null && Request.QueryString["prefNotaAcce"] != "")
                {
                    notaAcceDescrip = " Nota credito por Accesorios generada: " + Request.QueryString["prefNotaAcce"] + "-" + Request.QueryString["numNotaAcce"];
                    FormatosDocumentos formatoRecibo = new FormatosDocumentos();
                    formatoRecibo.Prefijo = Request.QueryString["prefNotaAcce"];
                    formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefNotaAcce"] + "'");
                    formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numNotaAcce"].ToString());
                    if (formatoRecibo.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                    }
                }
                if (Request.QueryString["prefPed"] != null)
                {
                    Utils.MostrarAlerta(Response, "Factura de Cliente Devuelta Exitosamente, pedido: " + Request.QueryString["prefPed"] + "-" + Request.QueryString["ped"] + ". Nota credito generada: " + Request.QueryString["prefNota"] + "-" + Request.QueryString["numNota"] + notaAcceDescrip + "");
                    FormatosDocumentos formatoRecibo = new FormatosDocumentos();
                    formatoRecibo.Prefijo = Request.QueryString["prefNota"];
                    formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefNota"] + "'");
                    formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numNota"].ToString());
                    if (formatoRecibo.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                    }
                }

                // "&prefNotaAcce=" + pedidoDevolucion.PrefNotaAccesorios + "&numNotaAcce=" + pedidoDevolucion.NumeNotaAccesorios);
                imglupa.Attributes.Add("OnClick", "ModalDialog(" + numeroPedidoOtro.ClientID + ",'SELECT rtrim(cast(MPV.mped_numepedi as char(10))) as Pedido FROM mpedidovehiculo MPV, masignacionvehiculo MAV, mvehiculo MVH WHERE MPV.test_tipoesta=30 AND MPV.pdoc_codigo=\\'" + prefijoPedidoOtro.SelectedValue + "\\' AND MAV.pdoc_codigo=MPV.pdoc_codigo AND MAV.mped_numepedi = MPV.mped_numepedi AND MAV.mveh_inventario = MVH.mveh_inventario AND MVH.test_tipoesta <> 60 ORDER BY MPV.mped_numepedi ' ,new Array() );");
                fechNota.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
        }
Exemplo n.º 6
0
        protected void Page_Init(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["pref"] != null && Request.QueryString["num"] != null)
                {
                    FormatosDocumentos formatoRecibo = new FormatosDocumentos();
                    formatoRecibo.Prefijo = Request.QueryString["pref"];
                    formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pref"] + "'");
                    formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["num"].ToString());
                    if (formatoRecibo.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                    }
                    if (Request.QueryString["falloDoc"] == "1")
                    {
                        Utils.MostrarAlerta(Response, "Se ha realizado el proceso correctamente!! pero por un eror desconocido no ha sido posible archivar los documentos soporte, por favor contacte a ECAS");
                    }
                }

                DatasToControls bind = new DatasToControls();
                string          yr   = DBFunctions.SingleData("SELECT pano_ano FROM ccontabilidad");
                Int16           año  = Convert.ToInt16(yr);
                bind.PutDatasIntoDropDownList(year, "SELECT pano_ano, PANO_DETALLE FROM pano where pano_ano >= " + año + " order by 1 desc");
                DatasToControls.EstablecerDefectoDropDownList(year, yr);
                bind.PutDatasIntoDropDownList(month, "SELECT pmes_mes, pmes_nombre FROM pmes WHERE pmes_mes != 0 AND pmes_mes != 13 order by 1");
                string mt = DBFunctions.SingleData("SELECT pmes_mes FROM ccontabilidad");
                DatasToControls.EstablecerDefectoDropDownList(month, DBFunctions.SingleData("SELECT pmes_nombre FROM pmes WHERE pmes_mes=" + mt + ""));
                //month.SelectedIndex=month.Items.IndexOf(new ListItem(mt,mt));
                maVig.Text = "  " + month.SelectedItem + " - " + yr + " ";
                // Descarta los documentos que no esten vigentes y tambien los que NO son contables como las ordenes de trabajo o producción, cotizaciones y pedidos
                bind.PutDatasIntoDropDownList(typeDoc, "SELECT pdoc_codigo,pdoc_codigo concat ' - ' concat pdoc_nombre FROM pdocumento where tvig_vigencia='V' and tdoc_tipodocu not in ('CT','CV','PC','PV','PI','OP','OT') order by pdoc_CODIGO");
                //Utils.llenarPrefijos(Response, ref typeDoc, "%", "%", "%");
                //bind.PutDatasIntoDropDownList(typePlant, "SELECT pdoc_codigo,pdoc_codigo concat ' - ' concat pdoc_nombre FROM pdocumento where tvig_vigencia is null or tvig_vigencia='V' order by pdoc_nombre");
                Utils.llenarPrefijos(Response, ref typePlant, "%", "%", "%");
                bind.PutDatasIntoDropDownList(compPlant, "SELECT mcom_numedocu FROM mcomprobante WHERE pdoc_codigo='" + typePlant.SelectedValue + "'");
                string pathToImports = ConfigurationManager.AppSettings["PathToImports"] + "comprobantes";
                //DatasToControls bind4 = new DatasToControls("");
                //bind.BindFromDirIntoLB(compCOBOL, pathToImports);
                IFormatProvider culture = new System.Globalization.CultureInfo("es-CO", true);
                DateTime        nd      = DateTime.Now;
                try{ nd = new DateTime(Convert.ToInt16(year.SelectedValue), Convert.ToInt16(month.SelectedValue), 1); }catch {};
                //Button1.Attributes.Add("onclick","return ValidarFechaIngresoComprobante();");

                /*  validador de vigencia de documentos
                 *  PDOC_CODIGO ||'-'||PDOC_NOMBRE ||' LA RESOLUCION DE FACTURACION ESTA POR ACABARSE, FALTAN ' || (PDOC_NUMEFINA - PDOC_ULTIDOCU) ||' DOCUMENTOS'
                 *  FROM PDOCUMENTO WHERE (PDOC_NUMEFINA - PDOC_ULTIDOCU) IN (100,75,50,25,15,10,5,4,3,2,1) AND TDOC_TIPODOCU = 'FC';
                 *
                 *  SELECT PDOC_CODIGO||'-'|| PDOC_NOMBRE||' LA FECHA RESOLUCION DE FACTURACION ESTA POR VENCERSE, FALTAN ', DAYS(CURRENT DATE) -DAYS(PDOC_FINFECHRESOFACT) , ' DIAS'
                 *  FROM PDOCUMENTO WHERE (DAYS(CURRENT DATE) -DAYS(PDOC_FINFECHRESOFACT)) IN (30,20,15,10,5,4,3,2,1) AND TDOC_TIPODOCU = 'FC';
                 *
                 */
            }
        }
Exemplo n.º 7
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         DatasToControls bind = new DatasToControls();
         bind.PutDatasIntoDropDownList(almacen, "SELECT palm_almacen,palm_descripcion FROM palmacen where (pcen_centcart is not null  or pcen_centteso is not null) and tvig_vigencia='V' order by palm_descripcion;");
         if (Request.QueryString["prefD"] != null && Request.QueryString["numD"] != null)
         {
             Response.Write("<script language:javascript>alert('Se ha creado el documento " + Request.QueryString["prefD"] + "-" + Request.QueryString["numD"] + "');</script>");
             try
             {
                 formatoConsignacion         = new FormatosDocumentos();
                 formatoConsignacion.Prefijo = Request.QueryString["prefD"];
                 formatoConsignacion.Numero  = Convert.ToInt32(Request.QueryString["numD"]);
                 formatoConsignacion.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefD"] + "'");
                 if (formatoConsignacion.Codigo != string.Empty)
                 {
                     if (formatoConsignacion.Cargar_Formato())
                     {
                         Response.Write("<script language:javascript>w=window.open('" + formatoConsignacion.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                     }
                 }
             }
             catch
             {
                 lb.Text += "Error al generar la impresión. Detalles : " + formatoConsignacion.Mensajes + "<br>";
             }
         }
         if (!DBFunctions.RecordExist("SELECT pdoc_codigo,pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='AT' and tvig_vigencia = 'V' "))
         {
             Response.Write("<script language:javascript>alert('No hay documentos del tipo AT definidos para anulación');</script>");
             prefijoDocumento.Enabled = false;
             prefijoDocumento.Enabled = false;
             aceptar.Enabled          = false;
         }
         else
         {
             //bind.PutDatasIntoDropDownList(prefijoDocumento, "SELECT pdoc_codigo,pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='AT' and tvig_vigencia = 'V' ORDER BY pdoc_descripcion ");
             Utils.llenarPrefijos(Response, ref prefijoDocumento, "%", "%", "AT");
             if (prefijoDocumento.Items.Count > 1)
             {
                 prefijoDocumento.Items.Insert(0, "Seleccione:");
             }
             else
             {
                 prefijoDocumento_SelectedIndexChanged(sender, e);
             }
             //        numeroTesoreria.Text = DBFunctions.SingleData("SELECT pdoc_ultidocu+1 FROM pdocumento WHERE pdoc_codigo='" + prefijoDocumento.SelectedValue + "'");
             prefijoDocumento.Enabled = true;
             aceptar.Enabled          = true;
         }
     }
     holderAnulaciones.Controls.Add(LoadControl(pathToControls + "AMS.Tesoreria.ConsignaCheques.Anulaciones.ascx"));
 }
Exemplo n.º 8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Introducir aquí el código de usuario para inicializar la página
            this.Page.SmartNavigation = true;
            if (!Page.IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                bind.PutDatasIntoDropDownList(ddlEmbarque,
                                              "SELECT DISTINCT MEM.MEMB_SECUENCIA, MEM.MEMB_NUMEEMBA " +
                                              "FROM MEMBARQUE MEM,DEMBARQUECKD DEM " +
                                              "WHERE MEM.MEMB_SECUENCIA=DEM.MEMB_SECUENCIA AND MEM.PEST_ESTADO='P';");
                //bind.PutDatasIntoDropDownList(ddlPrefDoc,"SELECT pdoc_codigo from pdocumento where tdoc_tipodocu='FP';");
                Utils.llenarPrefijos(Response, ref ddlPrefDoc, "%", "%", "FP");
                txtFecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
                CargarVehiculos();
                ddlEmbarque_SelectedIndexChanged(ddlEmbarque, e);
                ddlPrefDoc_SelectedIndexChanged(ddlPrefDoc, e);
                if (Request.QueryString["upd"] != null)
                {
                    Utils.MostrarAlerta(Response, "Se han nacionalizado los vehiculos.");
                }

                #region Reportes
                if (Request.QueryString["pref"] != null && Request.QueryString["num"] != null)
                {
                    FormatosDocumentos formatoFactura = new FormatosDocumentos();
                    Utils.MostrarAlerta(Response, "Se ha generado la factura con prefijo " + Request.QueryString["pref"] + " y número " + Request.QueryString["num"] + "");
                    try
                    {
                        formatoFactura.Prefijo = Request.QueryString["pref"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["num"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pref"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lblInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                }
                #endregion Reportes
            }
        }
Exemplo n.º 9
0
        protected void generarInforme2(string prefijo, string numero)
        {
            FormatosDocumentos formatoRecibo = new FormatosDocumentos();

            try
            {
                formatoRecibo.Prefijo = prefijo;
                formatoRecibo.Numero  = Convert.ToInt32(numero);
                formatoRecibo.Codigo  = "FORSOLVEH";
                if (formatoRecibo.Cargar_Formato())
                {
                    Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                }
            }
            catch
            {
                lb.Text += "Error al generar la impresión. Detalles : " + formatoRecibo.Mensajes + "<br>";
            }
        }
Exemplo n.º 10
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.Page.SmartNavigation = true;
     Ajax.Utility.RegisterTypeForAjax(typeof(AMS_Vehiculos_DevolucionPedidoMayor));
     if (!IsPostBack)
     {
         DatasToControls bind = new DatasToControls();
         txtFechaFac.Text = DateTime.Now.ToString("yyyy-MM-dd");
         MostrarPanel(plcInfoFact);
         bind.PutDatasIntoDropDownList(ddlAlmacen, "SELECT palm_almacen, palm_descripcion FROM dbxschema.palmacen where (pcen_centvvn is not null  or pcen_centvvu is not null) and TVIG_VIGENCIA = 'V' order by palm_descripcion;");
         bind.PutDatasIntoDropDownList(prefijoFactura, "SELECT pd.pdoc_codigo, pd.pdoc_codigo concat ' - ' concat pd.pdoc_nombre FROM dbxschema.pdocumento pd, pdocumentohecho pdh WHERE pd.tdoc_tipodocu='NC' AND pd.pdoc_codigo=pdh.pdoc_codigo AND pdh.palm_almacen='" + ddlAlmacen.SelectedValue + "' AND pdh.tpro_proceso='VN';");
         //bind.PutDatasIntoDropDownList(ddlFacturaD,"SELECT pd.pdoc_codigo, pd.pdoc_codigo concat ' - ' concat pd.pdoc_nombre FROM dbxschema.pdocumento pd, pdocumentohecho pdh WHERE pd.tdoc_tipodocu='FC' AND pd.pdoc_codigo=pdh.pdoc_codigo AND pdh.tpro_proceso='VN';");
         Utils.llenarPrefijos(Response, ref ddlFacturaD, "VN", "%", "FC");
         bind.PutDatasIntoDropDownList(ddlIVAFletes, "SELECT PIVA_PORCIVA,PIVA_DECRETO FROM PIVA ORDER BY PIVA_PORCIVA;");
         CambioTipoFacturacion(sender, e);
         //Impresion
         if (Request.QueryString["prefFC"] != null)
         {
             Utils.MostrarAlerta(Response, "Se ha creado la devolucion de cliente por venta mayor con prefijo " + Request.QueryString["prefFC"] + " y el número " + Request.QueryString["numFC"] + ".");
             FormatosDocumentos formatoRecibo = new FormatosDocumentos();
             try
             {
                 formatoRecibo.Prefijo = Request.QueryString["prefFC"];
                 formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numFC"]);
                 formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefFC"] + "'");
                 if (formatoRecibo.Codigo != string.Empty)
                 {
                     if (formatoRecibo.Cargar_Formato())
                     {
                         Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                     }
                 }
             }
             catch
             {
                 lb.Text += "Error al generar la impresión. Detalles : " + formatoRecibo.Mensajes + "<br>";
             }
         }
     }
 }
Exemplo n.º 11
0
        protected void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
                
				if(Request.QueryString["subprocess"]=="Fact")
				{
					plRow1.Visible = true;
					if(Request.QueryString["factGen"] != null)
					{
                        Utils.MostrarAlerta(Response, "Se ha creado la factura con prefijo " + Request.QueryString["prefF"] + " y número " + Request.QueryString["numF"] + ".!");
						formatoFactura=new FormatosDocumentos();
						try
						{
							formatoFactura.Prefijo=Request.QueryString["prefF"];
							formatoFactura.Numero=Convert.ToInt32(Request.QueryString["numF"]);
							formatoFactura.Codigo=DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='"+Request.QueryString["prefF"]+"'");
							if(formatoFactura.Codigo!=string.Empty)
							{
								if(formatoFactura.Cargar_Formato())
									Response.Write("<script language:javascript>w=window.open('"+formatoFactura.Documento+"','','HEIGHT=600,WIDTH=800');</script>");
							}
						}
						catch
						{
							lb.Text="Error al generar el formato. Detalles : <br>"+formatoFactura.Mensajes;
						}
					}
				}
				else if(Request.QueryString["subprocess"]=="Mod")
				{
					plRow2.Visible = true;
					DatasToControls bind = new DatasToControls();
					bind.PutDatasIntoDropDownList(this.ddlNLis,"SELECT mlis_numero FROM mlistaempaque ORDER BY 1");
					btnFacturar.Text = "Modificar";
				}
			}
		}
Exemplo n.º 12
0
        protected void ImprimirFormato(Object prefijo, Object numero)
        {
            FormatosDocumentos formatoFactura = new FormatosDocumentos();

            try
            {
                formatoFactura.Prefijo = Convert.ToString(prefijo);
                formatoFactura.Numero  = Convert.ToInt32(numero);
                formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + formatoFactura.Prefijo + "'");
                if (formatoFactura.Codigo != string.Empty)
                {
                    if (formatoFactura.Cargar_Formato())
                    {
                        Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                    }
                }
            }
            catch
            {
                //   lblError.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                //  Response.Write("<script language:javascript>alert('Error al generar el formato.');</script>");
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Introducir aquí el código de usuario para inicializar la página
            if (!IsPostBack)
            {
                if (Request["prefOP"] != null && Request["numOP"] != null && Request["prefT"] != null && Request["pDoc"] != null && Request["nDoc"] != null)
                {
                    string strRes = (Request["ens"] != null)?"ensamble":"producción";
                    Utils.MostrarAlerta(Response, "Se ha creado satisfactoriamente la orden de " + strRes + " " + Request["pDoc"] + "-" + Request["nDoc"] + "");
                    //Pedido 1
                    FormatosDocumentos formatoFactura = new FormatosDocumentos();
                    try{
                        formatoFactura.Prefijo = Request.QueryString["pDoc"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["nDoc"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pDoc"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lb.Text = "Error al generar el formato pedido 1. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                    //Pedido 2
                    formatoFactura = new FormatosDocumentos();
                    if (Request["dbl"] != null && Request.QueryString["dbl"].ToString().Length > 0)
                    {
                        try
                        {
                            formatoFactura.Prefijo = Request.QueryString["prefOP"];
                            formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["numOP"]) - 1;
                            formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pDoc"] + "'");
                            if (formatoFactura.Codigo != string.Empty)
                            {
                                if (formatoFactura.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                }
                            }
                        }
                        catch
                        {
                            lb.Text = "Error al generar el formato pedido 2. Detalles : <br>" + formatoFactura.Mensajes;
                        }
                    }
                    //Transferencia 1
                    formatoFactura = new FormatosDocumentos();
                    if (Request["numT"] != null && Request.QueryString["numT"].ToString().Length > 0)
                    {
                        try
                        {
                            formatoFactura.Prefijo = Request.QueryString["prefT"];
                            formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["numT"]);
                            formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefT"] + "'");
                            if (formatoFactura.Codigo != string.Empty)
                            {
                                if (formatoFactura.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                }
                            }
                        }
                        catch
                        {
                            lb.Text = "Error al generar el formato transferencia 1. Detalles : <br>" + formatoFactura.Mensajes;
                        }
                    }
                    //Transferencia 2
                    formatoFactura = new FormatosDocumentos();
                    if (Request["dbl"] != null && Request.QueryString["dbl"].ToString().Length > 0)
                    {
                        try
                        {
                            formatoFactura.Prefijo = Request.QueryString["prefT"];
                            formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["numT"]) - 1;
                            formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefT"] + "'");
                            if (formatoFactura.Codigo != string.Empty)
                            {
                                if (formatoFactura.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                }
                            }
                        }
                        catch
                        {
                            lb.Text = "Error al generar el formato transferencia 2. Detalles : <br>" + formatoFactura.Mensajes;
                        }
                    }
                }

                string campoProg;
                if (Request.QueryString["ens"] != null)
                {
                    Utils.FillDll(ddlPrefijo, "SELECT pdoc_codigo,pdoc_codigo CONCAT '-' CONCAT pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='OP' order by pdoc_codigo,pdoc_descripcion", false);
                }
                else
                {
                    Utils.FillDll(ddlPrefijo, "SELECT pdoc_codigo,pdoc_codigo CONCAT '-' CONCAT pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='OP' order by pdoc_codigo desc,pdoc_descripcion", false);
                }
                try
                {
                    tbNumero.Text = DBFunctions.SingleData("SELECT max(MORD_NUMEORDE)+1 FROM MORDENPRODUCCION WHERE pdoc_codigo='" + ddlPrefijo.SelectedValue + "'");
                    Utils.FillDll(ddlVendedor, "SELECT pven_codigo, pven_nombre FROM pvendedor WHERE tvend_codigo='VM' AND pven_vigencia='V' order by pven_nombre", false);
                    Utils.FillDll(ddlAlmacen, "SELECT PA.palm_almacen, MP.mpla_funcion FROM PALMACEN PA, MPLANTAS MP WHERE PA.palm_almacen=MP.mpla_codigo order by PA.palm_descripcion;", false);
                    Utils.FillDll(ddlAlmMat, "SELECT PA.palm_almacen, PA.palm_descripcion FROM PALMACEN PA order by PA.palm_descripcion;", false);
                    Utils.FillDll(ddlPedido, "SELECT pped_codigo,pped_nombre FROM ppedido WHERE tped_codigo='T' order by pped_nombre", false);
                    Utils.FillDll(ddlTransferencia, "SELECT pdoc_codigo,pdoc_codigo CONCAT '-' CONCAT pdoc_descripcion FROM pdocumento WHERE tdoc_tipodocu='TT' order by pdoc_codigo,pdoc_descripcion", false);
                    tbFecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
                    if (Request.QueryString["ens"] != null)
                    {
                        ViewState["TIPO"] = "E";
                        lblElemento.Text  = "Catálogo del Vehículo :";
                        campoProg         = "PCAT_CODIGO";
                    }
                    else
                    {
                        ViewState["TIPO"] = "P";
                        lblElemento.Text  = "Código del Item :";
                        campoProg         = "MITE_CODIGO";
                    }

                    //Programa produccion
                    DateTime dttFecha    = DateTime.Now;
                    DateTime dttFecha1   = dttFecha.AddMonths(-1);
                    DateTime dttFecha2   = dttFecha.AddMonths(-2);
                    DateTime dttFecha2h  = dttFecha.AddMonths(-3);
                    DateTime dttFecha2hh = dttFecha.AddMonths(-4);
                    DateTime dttFecha3   = dttFecha.AddMonths(1);
                    DateTime dttFecha4   = dttFecha.AddMonths(2);

                    Utils.FillDll(ddlLote,
                                  "SELECT mprog_numero, mprog_numero from MPROGRAMAPRODUCCION mp " +
                                  "where mp.mprog_consecutivo in (" +
                                  " select dp.mprog_consecutivo " +
                                  " from DPROGRAMAPRODUCCION dp " +
                                  " where " +
                                  " dp.mprog_consecutivo=mp.mprog_consecutivo and " +
                                  " dp." + campoProg + " IS NOT NULL and dp.dprog_cantidad > dp.dprog_total) ORDER BY mprog_numero;", false);
                }
                catch { }
            }
            else
            {
                if (Session["dtProduccion"] != null)
                {
                    dtProduccion = (DataTable)Session["dtProduccion"];
                }
            }
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                //	bind.PutDatasIntoDropDownList(catalogo,CatalogoVehiculos.CATALOGOVEHICULOSENALMACEN);
                //    catalogo.Items.Insert(0, new ListItem("Seleccione el Catálogo...", ""));

                try
                {
                    bind.PutDatasIntoDropDownList(prefijo, "SELECT PDOC_CODIGO,PDOC_NOMBRE FROM PDOCUMENTO WHERE TDOC_TIPODOCU = 'MV'");
                    if (prefijo.Items.Count > 0)
                    {
                        prefijo.Items.Insert(0, new ListItem("Seleccione el Prefijo...", ""));
                    }
                }
                catch
                {
                    Utils.MostrarAlerta(Response, "No ha parametrizado ningun documento del tipo MV");
                }

                bind.PutDatasIntoDropDownList(vinVehiculo, string.Format(Vehiculos.VEHICULOSENALMACEN));
                vinVehiculo.Items.Insert(0, new ListItem("Seleccione el V I N...", ""));

                bind.PutDatasIntoDropDownList(ubicacionVehiculo, "SELECT pubi_codigo, pubi_nombre FROM pubicacion where PUBI_VIGENCIA = 'V' ");
                ubicacionVehiculo.Items.Insert(0, new ListItem("Seleccione la Ubicación...", ""));

                calendar.Text = DateTime.Now.ToString("yyyy-MM-dd");
                //	this.Cargar_Ubicacion_Actual(vinVehiculo.SelectedItem.Text);

                //if (Session["actualizado"] != null)
                if (Request.QueryString["vin"] != null)
                {
                    Utils.MostrarAlerta(Response, "Actualización completa! La nueva ubicación del vehículo: " + Request.QueryString["vin"] + " se ha definido en: " + Request.QueryString["ubicacion"]);
                    Utils.MostrarAlerta(Response, "Se ha creado la factura con prefijo " + Request.QueryString["prefijo"] + " y número " + Request.QueryString["numero"] + "");
                    formatoFactura = new FormatosDocumentos();
                    try
                    {
                        formatoFactura.Prefijo = Request.QueryString["prefijo"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["numero"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefijo"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                        formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefijo"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=500,WIDTH=700');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lbInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                    Session.Clear();
                }
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Introducir aquí el código de usuario para inicializar la página
            Page.SmartNavigation = true;
            if (!Page.IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                bind.PutDatasIntoDropDownList(ddlCuentaEditar, "SELECT PCUE_CODIGO, PCUE_NOMBRE CONCAT ' (' CONCAT PCUE_CODIGO CONCAT ' - ' CONCAT PCUE_NUMERO CONCAT ')' FROM PCUENTACORRIENTE ORDER BY PCUE_NOMBRE;");
                bind.PutDatasIntoDropDownList(ddlCreditoEditar, "SELECT MOBL_NUMERO FROM MOBLIGACIONFINANCIERA WHERE PCUE_CODIGO='" + ddlCuentaEditar.SelectedValue + "' ORDER BY MOBL_NUMERO;");

                bind.PutDatasIntoDropDownList(ddlCuenta, "SELECT PCUE_CODIGO, PCUE_NOMBRE CONCAT ' (' CONCAT PCUE_CODIGO CONCAT ' - ' CONCAT PCUE_NUMERO CONCAT ')' FROM PCUENTACORRIENTE ORDER BY PCUE_NOMBRE;");
                //bind.PutDatasIntoDropDownList(ddlDocumento,"SELECT PDOC_CODIGO, PDOC_NOMBRE FROM PDOCUMENTO WHERE TDOC_TIPODOCU='ND' ORDER BY PDOC_NOMBRE;");
                Utils.llenarPrefijos(Response, ref ddlDocumento, "%", "%", "ND");
                lblNumDocumento.Text = DBFunctions.SingleData("SELECT PDOC_ULTIDOCU+1 FROM PDOCUMENTO WHERE PDOC_CODIGO='" + ddlDocumento.SelectedValue + "';");

                bind.PutDatasIntoDropDownList(ddlAlmacen, "SELECT PALM_ALMACEN, PALM_DESCRIPCION FROM PALMACEN where (pcen_centcart is not null  or pcen_centteso is not null) and tvig_vigencia='V' order by palm_descripcion;");
                bind.PutDatasIntoDropDownList(ddlTipoCredito, "SELECT PCRE_CODIGO, PCRE_NOMBRE FROM PCREDITOBANCARIO ORDER BY PCRE_NOMBRE;");
                bind.PutDatasIntoDropDownList(ddlTipoTasa, "SELECT PTAS_CODIGO, PTAS_NOMBRE concat ' (' concat rtrim(char(ptas_monto)) concat ')' FROM PTASACREDITO ORDER BY PTAS_NOMBRE;");
                bind.PutDatasIntoDropDownList(ddlCondicion, "SELECT TCON_CODIGO, TCON_NOMBRE FROM TCONDICIONCREDITOBANCARIO ORDER BY TCON_NOMBRE;");
                CrearTablas();
                Bind();
                if (Request.QueryString["upd"] != null)
                {
                    Response.Write("<script language:javascript>alert('Las obligaciones financieras se han actualizado');</script>");

                    if (Request["prf"] != null && Request["num"] != null)
                    {
                        FormatosDocumentos formatoFactura = new FormatosDocumentos();
                        try
                        {
                            formatoFactura.Prefijo = Request.QueryString["prf"];
                            formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["num"]);
                            formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prf"] + "'");
                            if (formatoFactura.Codigo != string.Empty)
                            {
                                if (formatoFactura.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                }
                            }

                            formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prf"] + "'");
                            if (formatoFactura.Codigo != string.Empty)
                            {
                                if (formatoFactura.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                }
                            }
                        }
                        catch
                        {
                            lblInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                        }
                    }
                }
            }
            else
            {
                dtDesembolsos = (DataTable)ViewState["DT_DESEMBOLSOS"];
                dtPagos       = (DataTable)ViewState["DT_PAGOS"];
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Tipo = Request.QueryString["actor"];            //carga el tipo de de registro a realizar
            //this.ClearChildViewState();
            LoadDataColumns();
            string nLis1 = Request.QueryString["nped"];             //Numero de lista de empaque

            string[] nLis = nLis1.ToString().Split('-');
            kit     = Request.QueryString["kitPed"]; //Numero de lista de empaque
            AnoA    = Request.QueryString["AnoA"];
            almacen = Request.QueryString["almacen"];
            if (nLis1.Length == 0)//Si no es valido el numero de lista de empaque que no haga nada
            {
                return;
            }

            //string centavos = ConfigurationManager.AppSettings["ManejoCentavos"];
            //if (Utils.EsEntero(centavos))
            //    numDecimales = Convert.ToInt32(centavos);

            try { numDecimales = Convert.ToInt16(DBFunctions.SingleData("select cinv_numedeci from cinventario")); }
            catch (Exception er) { numDecimales = 2; }

            if (!IsPostBack)
            {
                //Impimir trasnferencia:
                if (Request.QueryString["prefPed"] != null)
                {
                    FormatosDocumentos formatoFactura = new FormatosDocumentos();
                    try
                    {
                        formatoFactura.Prefijo = Request.QueryString["prefPed"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["numPed"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefPed"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lbInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                }

                Session.Clear();
                dgItems.EditItemIndex = -1;
                DatasToControls bind = new DatasToControls();
                hdCargoTrans.Value = DBFunctions.SingleData("SELECT DISTINCT MPD.tcar_cargo FROM   dbxschema.mpedidotransferencia MPD INNER JOIN dbxschema.mpedidoitem MPI ON MPD.pped_codigo=MPI.pped_codigo AND MPD.mped_numero=MPI.mped_numepedi INNER JOIN dbxschema.dlistaempaque DLIS ON MPI.pped_codigo=DLIS.pped_codigo AND MPI.mped_numepedi=DLIS.mped_numepedi WHERE DLIS.mlis_numero=" + nLis[0] + "");
                bind.PutDatasIntoDropDownList(ddlAlmacen, "SELECT palm_almacen, palm_descripcion FROM palmacen WHERE PCEN_CENTINV IS NOT NULL and tvig_vigencia='V' ORDER BY PALM_DESCRIPCION");
                bind.PutDatasIntoDropDownList(ddlPIVA, "SELECT piva_porciva, piva_decreto FROM piva order by 2");                                                                   //Porcentaje de IVA
                string tp = DBFunctions.SingleData("SELECT t1.tped_codigo from PPEDIDO as t1, DLISTAEMPAQUE t2 WHERE t1.pped_codigo=t2.pped_codigo and t2.mlis_numero=" + nLis[0]); //Tipo de pedido
                ViewState["tipoPedido"] = tipoPedido = tp;
                PublicarInformacionVendedor(nLis);

                if (tp == "T")
                {
                    //Si es transferencia de taller se trae un documento tipo transferencia de taller y adicionalmente se bloquean los campos de texto de fletes, ni iva de fletes

                    Utils.llenarPrefijos(Response, ref ddlCodDoc, "%", ddlAlmacen.SelectedValue, "TT");
                    txtFlet.Enabled = ddlPIVA.Enabled = false;
                }
                else if (tp == "E")
                {
                    //Si es CONSUMO INTERNO  se trae un documento tipo CONSUMO INTERNO E  y adicionalmente se bloquean los campos de texto de fletes, ni iva de fletes
                    Utils.llenarPrefijos(Response, ref ddlCodDoc, "%", ddlAlmacen.SelectedValue, "CI");
                    txtFlet.Enabled = ddlPIVA.Enabled = false;
                }
                else
                {
                    //Si no es una transferencia se traen documentos de tipo factura cliente
                    //   falta filtrar por almacen
                    Utils.llenarPrefijos(Response, ref ddlCodDoc, "IC", ddlAlmacen.SelectedValue, "FC");
                    txtFlet.Enabled = ddlPIVA.Enabled = true;
                }


                IFormatProvider culture = new System.Globalization.CultureInfo("es-CO", true);
                tbDate.Text = DateTime.Now.GetDateTimeFormats()[6];
                //tbDate.Text = DateTime.Now;
                ds = new DataSet();
                for (int i = 0; i < nLis.Length - 1; i++)
                {
                    DBFunctions.Request(ds, IncludeSchema.NO, "SELECT t1.mnit_nit,t1.mnit_nombres concat ' ' concat t1.mnit_apellidos, t2.palm_almacen from MNIT as t1,MLISTAEMPAQUE as t2 WHERE t1.MNIT_NIT=t2.MNIT_NIT AND t2.MLIS_NUMERO=" + nLis[i] + "");
                    //Observacion (PRIMERA ENCONTRADA EN LOS PEDIDOS DE LA LISTA DE EMPAQUE)
                    txtObs.Text += DBFunctions.SingleData(
                        @"SELECT MP.MPED_OBSERVACION  
		                FROM MPEDIDOITEM MP, DLISTAEMPAQUE DL  
					   WHERE DL.MLIS_NUMERO="                     + nLis[i] + @" AND DL.PPED_CODIGO=MP.PPED_CODIGO AND DL.MPED_NUMEPEDI=MP.MPED_NUMEPEDI  
					FETCH FIRST 1 ROWS ONLY;"
                        );
                }
                try
                {
                    txtNIT.Text  = ds.Tables[0].Rows[0][0].ToString();
                    txtAlm.Text  = ds.Tables[0].Rows[0][2].ToString();
                    txtNITa.Text = ds.Tables[0].Rows[0][1].ToString();
                }
                catch {}
                //Ahora cargamos los dias de plazo que tiene este cliente
                if (DBFunctions.SingleData("SELECT coalesce(mcli_diasplaz,0) FROM mcliente WHERE mnit_nit='" + txtNIT.Text + "'").Length > 0)
                {
                    txtDiasP.Text = DBFunctions.SingleData("SELECT coalesce(mcli_diasplaz,0) FROM mcliente WHERE mnit_nit='" + txtNIT.Text + "'");
                }
                else
                {
                    txtDiasP.Text = "0";
                }

                //txtFlet.Attributes.Add("onkeyup", "NumericMask(" + txtFlet.ClientID + ");");
                txtFlet.Attributes.Add("onkeyup", "CalculoIva(" + txtFlet.ClientID + "," + ddlPIVA.ClientID + "," + tbIvaFlts.ClientID + "," + txtTotIF.ClientID + ",'" + txtTotal.ClientID + "','" + txtGTot.ClientID + "');");
                ddlPIVA.Attributes.Add("onchange", "CambioIva(" + txtFlet.ClientID + "," + ddlPIVA.ClientID + "," + tbIvaFlts.ClientID + "," + txtTotIF.ClientID + ",'" + txtTotal.ClientID + "','" + txtGTot.ClientID + "');");
            }
            txtNumDoc.Text = DBFunctions.SingleData("SELECT pdoc_ultidocu+1 FROM pdocumento WHERE pdoc_codigo='" + ddlCodDoc.SelectedValue + "'");
            tipoPedido     = ViewState["tipoPedido"].ToString();
            if (Session["dtInsertsF"] == null)
            {
                LlenarTabla();
            }
            else
            {
                dtInserts = (DataTable)Session["dtInsertsF"];
                //BindDatas();
            }
            if (dtInserts.Rows.Count == 0)
            {
                LlenarTabla();
            }
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Introducir aquí el código de usuario para inicializar la página
            if (!IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                //		bind.PutDatasIntoDropDownList(ddlConcesionario,"SELECT MN.MNIT_NIT, MN.MNIT_APELLIDOS FROM MNIT MN, MCONCESIONARIO MC WHERE MC.MNIT_NIT=MN.MNIT_NIT ORDER BY MNIT_APELLIDOS;");
                //		bind.PutDatasIntoDropDownList(ddlConcesionario,"SELECT MN.MNIT_NIT, MN.nombre         FROM vMNIT MN, MCONCESIONARIO MC WHERE MC.MNIT_NIT=MN.MNIT_NIT ORDER BY mn.nombre;");
                bind.PutDatasIntoDropDownList(ddlConcesionario, "SELECT distinct MN.MNIT_NIT, MN.nombre FROM vMNIT MN, MCONCESIONARIO MC, mordenpostventa mo WHERE MC.MNIT_NIT=MN.MNIT_NIT and MC.MNIT_NIT=Mo.MNIT_NITconc and mo.mgar_numero is Null ORDER BY mn.nombre;");
                ddlConcesionario.Items.Insert(0, new ListItem("--seleccione--", ""));
                bind.PutDatasIntoDropDownList(ddlPrefOrden, "SELECT PDOC_CODIPOST FROM CTALLER;");
                bind.PutDatasIntoDropDownList(ddlVendedor, "SELECT pven_codigo,pven_nombre from pvendedor WHERE TVEND_CODIGO = 'AG';");
                //bind.PutDatasIntoDropDownList(ddlAutorizar,"SELECT tres_sino,tres_nombre from trespuestasino;");
                ddlVendedor.Items.Insert(0, new ListItem("--seleccione--", ""));
                ddlNumeOrden.Items.Insert(0, new ListItem("--seleccione--", ""));
                txtFechaProceso.Text = DateTime.Now.ToString("yyyy-MM-dd");
                if (Request.QueryString["idG"] != null)
                {
                    Utils.MostrarAlerta(Response, "La autorización se ha realizado con el número " + Request.QueryString["idG"] + ".");
                    if (Request["prefOT"] != null && Request["prefOT"] != string.Empty && Request["numOT"] != null && Request["numOT"] != string.Empty)
                    {
                        FormatosDocumentos formatoRecibo = new FormatosDocumentos();
                        try
                        {
                            formatoRecibo.Prefijo = Request["prefOT"];
                            formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numOT"]);
                            formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefOT"] + "'");
                            if (formatoRecibo.Codigo != string.Empty)
                            {
                                if (formatoRecibo.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                                }
                            }
                        }
                        catch
                        {
                            Utils.MostrarAlerta(Response, "Error al generar la impresión. Detalles : " + formatoRecibo.Mensajes.Replace("'", "") + "");
                        }

                        try
                        {
                            formatoRecibo.Prefijo = Request["tipoPED"];
                            formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numPED"]);
                            formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.PPEDIDO WHERE pped_codigo='" + Request.QueryString["tipoPED"] + "'");
                            if (formatoRecibo.Codigo != string.Empty)
                            {
                                if (formatoRecibo.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                                }
                            }
                        }
                        catch
                        {
                            Utils.MostrarAlerta(Response, "Error al generar la impresión. Detalles : " + formatoRecibo.Mensajes.Replace("'", "") + "");
                        }

                        try
                        {
                            formatoRecibo.Prefijo = Request["prefTRA"];
                            formatoRecibo.Numero  = Convert.ToInt32(Request.QueryString["numTRA"]);
                            formatoRecibo.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["prefTRA"] + "'");
                            if (formatoRecibo.Codigo != string.Empty)
                            {
                                if (formatoRecibo.Cargar_Formato())
                                {
                                    Response.Write("<script language:javascript>w=window.open('" + formatoRecibo.Documento + "','','HEIGHT=600,WIDTH=600');</script>");
                                }
                            }
                        }
                        catch
                        {
                            Utils.MostrarAlerta(Response, "Error al generar la impresión. Detalles : " + formatoRecibo.Mensajes.Replace("'", "") + "");
                        }
                    }
                }
            }
        }
Exemplo n.º 18
0
        protected void Crear_alquiler(object sender, EventArgs e)
        {
            ArrayList sqlRefs     = new ArrayList();
            string    horaInicio  = txtHHInicio.Text + ':' + txtMMInicio.Text + ':' + "00";
            string    horaEntrega = txtHHEntrega.Text + ':' + txtMMEntrega.Text + ':' + "00";
            DataTable dtElementos = Session["tablaElementos"] as DataTable;
            string    centrocosto = DBFunctions.SingleData("select PCCO_CENTCOST from MACTIVOFIJO WHERE MAFJ_CODIACTI = '" + dtElementos.Rows[0][0].ToString() + "'");

            //validamos que los campos de las horas tengan datos
            if (horaInicio.ToString() == "" || horaEntrega.ToString() == "")
            {
                Utils.MostrarAlerta(Response, "No ha llenado los campos de horas");
                return;
            }
            //Ahora revisamos si la clave del vendedor es valida o no
            if ((DBFunctions.SingleData("SELECT pven_clave FROM pvendedor WHERE pven_codigo='" + ddlVendedor.SelectedValue + "'") != tbClaveVend.Text.Trim()) || (ddlVendedor.SelectedValue == "0"))
            {
                Utils.MostrarAlerta(Response, "La clave de " + ddlVendedor.SelectedItem.Text + " es invalida.\\nRevise Por Favor!");
                return;
            }
            if (txtObserv.Text == "")
            {
                txtObserv.Text = "Orden de Alquiler";
            }
            sqlRefs.Add("INSERT INTO MORDENALQUILER VALUES('" + ddlPrefijo.SelectedValue + "'," + txtNumero.Text.ToString() + ",'" + txtNit.Text + "', '2', '" + txtFecha.Text + "' , '" + txtFEchini.Text + "', '" + horaInicio + "', '" + txtFechentrg.Text + "', '" + horaEntrega + "', '" + ddlAlmacen.SelectedValue + "', '" + txtObserv.Text + "')");

            for (int i = 0; i < dtElementos.Rows.Count; i++)
            {
                sqlRefs.Add("INSERT INTO DORDENALQUILER VALUES('" + ddlPrefijo.SelectedValue + "'," + txtNumero.Text.ToString() + ",'" + dtElementos.Rows[i][0] + "', '" + dtElementos.Rows[i][5] + "', '" + dtElementos.Rows[i][6] + "' , '2', '" + dtElementos.Rows[i][3] + "', '" + dtElementos.Rows[i][4] + "', null)");
            }
            for (int i = 0; i < dtElementos.Rows.Count; i++)
            {
                sqlRefs.Add("UPDATE MALQUILERACTIVOS SET TEST_ESTADO = 2 WHERE MAFJ_CODIACTI = '" + dtElementos.Rows[i][0] + "'");
            }
            double valorVenta = Math.Round(Convert.ToDouble(totalVenta.Text.Substring(1)), 0);
            double valorIva   = Math.Round(Convert.ToDouble(txtIva.Text.Substring(1)), 0);

            sqlRefs.Add("INSERT INTO mfacturacliente VALUES('" + ddlPrefijo.SelectedValue + "'," + txtNumero.Text.ToString() + ",'" + txtNit.Text + "','" + ddlAlmacen.SelectedValue + "','F','V'," +
                        "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + Convert.ToDouble(valorVenta) + ", " + Convert.ToDouble(valorIva) + ", 0, 0" +
                        ", 0, 0, 0, 0,'" + centrocosto + "'," +
                        "'Factura Alquiler Vehiculos','" + ddlVendedor.SelectedValue + "','" + usuario + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')");
            sqlRefs.Add("UPDATE PDOCUMENTO SET PDOC_ULTIDOCU = PDOC_ULTIDOCU+1 WHERE PDOC_CODIGO = '" + ddlPrefijo.SelectedValue + "';");
            if (DBFunctions.Transaction(sqlRefs))
            {
                contaOnline.contabilizarOnline(ddlPrefijo.SelectedValue.ToString(), Convert.ToInt32(txtNumero.Text.ToString()), Convert.ToDateTime(txtFecha.Text), "");
                Utils.MostrarAlerta(Response, "Se ha creado la factura con prefijo " + ddlPrefijo.SelectedValue.ToString() + " y número " + txtNumero.Text.ToString() + "");
                formatoFactura = new FormatosDocumentos();
                try
                {
                    formatoFactura.Prefijo = ddlPrefijo.SelectedValue.ToString();
                    formatoFactura.Numero  = Convert.ToInt32(txtNumero.Text);
                    formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefijo.SelectedValue + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                        }
                    }
                    formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefijo.SelectedValue + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=500,WIDTH=700');</script>");
                        }
                    }
                    string indexPage = ConfigurationManager.AppSettings["MainIndexPage"];
                    Session.Clear();
                    Response.Redirect("" + indexPage + "?process=Vehiculos.FacturacionTramite&prefD=" + ddlPrefijo.SelectedValue + "&numD=" + txtNumero.Text + "");
                }
                catch
                {
                    lberror.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                }
            }
            else
            {
                lberror.Text = "Error ejecutando:" + DBFunctions.exceptions;
            }
        }
Exemplo n.º 19
0
        //LOAD--------------------------------------------------------
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Ajax.Utility.RegisterTypeForAjax(typeof(AMS_Produccion_EntradasProduccion));
            dtItems = (DataTable)ViewState["dtItems"];
            if (!IsPostBack)
            {
                IFormatProvider culture = new System.Globalization.CultureInfo("es-CO", true);
                bind.PutDatasIntoDropDownList(ddlAlmacen, "SELECT PA.palm_almacen, PA.palm_descripcion FROM PALMACEN PA, MPLANTAS MP WHERE PA.palm_almacen=MP.mpla_codigo;");
                bind.PutDatasIntoDropDownList(ddlVendedor, string.Format(Almacen.VENDEDORESPORALMACEN, ddlAlmacen.SelectedValue));
                //bind.PutDatasIntoDropDownList(ddlPrefE, string.Format(Documento.DOCUMENTOSTIPOHECHO, "FP", "IP", ddlAlmacen.SelectedValue));
                string sede = ddlAlmacen.SelectedValue.ToString();
                Utils.llenarPrefijos(Response, ref ddlPrefE, "IP", sede, "FP");
                if (ddlPrefE.Items.Count > 0)
                {
                    txtNumFacE.Text = DBFunctions.SingleData(string.Format(Documento.PROXIMODOCUMENTO, ddlPrefE.SelectedValue));
                }
                else
                {
                    txtNumFacE.Text = "0";
                    Utils.MostrarAlerta(Response, "Usted NO HO configurado un documento del tipo FACTURA PROVEEDOR para el proceso PROCESOS PRODUCCION en esta sede, configurelo ...! ");
                    return;
                }
                bind.PutDatasIntoDropDownList(ddlPIVA, "SELECT piva_porciva, piva_decreto FROM piva ORDER BY piva_porciva");
                //bind.PutDatasIntoDropDownList(ddlPrefOrden,"SELECT pdoc_codigo from pdocumento where tdoc_tipodocu='OP';");
                Utils.llenarPrefijos(Response, ref ddlPrefOrden, "%", "%", "OP");
                bind.PutDatasIntoDropDownList(ddlNumOrden, "SELECT mord_numeorde from mordenproduccion where pdoc_codigo='" + ddlPrefOrden.SelectedValue + "' and test_estado='A' and mord_tipo='P' order by mord_numeorde;");
                tbDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                //txtFlet.Attributes.Add("onkeyup","CalculoIva("+txtFlet.ClientID+","+ddlPIVA.ClientID+","+txtTotIF.ClientID+",'"+txtTotal.ClientID+"','"+txtGTot.ClientID+"');");
                //ddlPIVA.Attributes.Add("onchange","CambioIva("+txtFlet.ClientID+","+ddlPIVA.ClientID+","+txtTotIF.ClientID+",'"+txtTotal.ClientID+"','"+txtGTot.ClientID+"');");
                txtFlet.Attributes.Add("onkeyup", "NumericMaskE(this,event);Totales();");
                txtTotalExternos.Attributes.Add("onkeyup", "NumericMaskE(this,event);Totales();");
                txtDesc.Attributes.Add("onkeyup", "NumericMaskE(this,event);Totales();");
                txtIVA.Attributes.Add("onkeyup", "NumericMaskE(this,event);Totales();");
                txtTotal.Attributes.Add("onkeyup", "NumericMaskE(this,event);Totales();");
                ddlPIVA.Attributes.Add("onchange", "Totales();");
                CambiaProceso(sender, e);
                plcTotales.Visible = false;

                //Cierre de orden de producción
                Utils.llenarPrefijos(Response, ref ddlPrefijoAjuste, "%", "%", "AJ");
                ddlPrefijoAjuste_OnSelectedIndexChanged(null, null);

                #region Reportes
                if (Request.QueryString["pref"] != null && Request.QueryString["num"] != null)
                {
                    FormatosDocumentos formatoFactura = new FormatosDocumentos();
                    Utils.MostrarAlerta(Response, "Se ha generado la factura con prefijo " + Request.QueryString["pref"] + " y número " + Request.QueryString["num"] + "");
                    try
                    {
                        formatoFactura.Prefijo = Request.QueryString["pref"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["num"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pref"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lbInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                }

                //Si se cerró la orden de producción
                if (Request.QueryString["act"] != null)
                {
                    Utils.MostrarAlerta(Response, "La orden ha sido cerrada");
                    Imprimir.ImprimirRPT(Response, Request.QueryString["prefA"], Convert.ToInt32(Request.QueryString["numA"]), true);
                }

                #endregion Reportes
            }
        }
Exemplo n.º 20
0
        protected void guardar_Click(object Sender, EventArgs e)
        {
            string             error             = "";
            FormatosDocumentos formatoRecibo     = new FormatosDocumentos();
            Control            encabezado        = phEncabezado.Controls[0];
            Control            pagos             = phPagos.Controls[0];
            Recibo             miRecibo          = new Recibo();
            DataTable          tablaPagar        = new DataTable();
            DataTable          tablaNC           = new DataTable();
            DataTable          tablaPagos        = new DataTable();
            DataTable          tablaRtns         = new DataTable();
            DataTable          tablaAbonos       = new DataTable();
            DataTable          tablaPostFechados = new DataTable();
            DataTable          tablaAbonosDev    = new DataTable();

            tablaPagar        = (DataTable)Session["tablaPagar"];
            tablaNC           = (DataTable)Session["tablaNC"];
            tablaPagos        = (DataTable)Session["tablaPagos"];
            tablaRtns         = (DataTable)Session["tablaRtns"];
            tablaAbonos       = (DataTable)Session["tablaAbonos"];
            tablaPostFechados = (DataTable)Session["tablaPost"];
            tablaAbonosDev    = (DataTable)Session["tablaAbonosDev"];
            this.Validar_DataTables(ref tablaPagar, ref tablaNC, ref tablaPagos, ref tablaRtns, ref tablaAbonos, ref tablaPostFechados, ref tablaAbonosDev);
            if (Validaciones_Especificas(((DropDownList)encabezado.FindControl("tipoRecibo")).SelectedValue, ref error, tablaPagar, tablaNC, tablaPagos, tablaRtns, tablaAbonos, tablaPostFechados, tablaAbonosDev))
            {
                Utils.MostrarAlerta(Response, "" + error + "");
            }
            else
            {
                if (Request.QueryString["tipo"] == "RC")
                {
                    miRecibo = new Recibo(tablaPagar, tablaNC, tablaPagos, tablaRtns, tablaAbonos, tablaPostFechados);
                }
                else if (Request.QueryString["tipo"] == "CE")
                {
                    miRecibo = new Recibo(tablaPagar, tablaNC, tablaPagos, tablaRtns, tablaAbonosDev);
                }
                else if (Request.QueryString["tipo"] == "RP")
                {
                    miRecibo = new Recibo(tablaPagos);
                }
                miRecibo.PrefijoRecibo        = ((DropDownList)encabezado.FindControl("prefijoRecibo")).SelectedValue;
                miRecibo.NumeroRecibo         = Convert.ToInt32(((TextBox)encabezado.FindControl("numeroRecibo")).Text);
                miRecibo.Fecha                = ((TextBox)encabezado.FindControl("fecha")).Text;
                miRecibo.TipoRecibo           = ((DropDownList)encabezado.FindControl("tipoRecibo")).SelectedValue;
                miRecibo.DatCli               = ((TextBox)encabezado.FindControl("datCli")).Text;
                miRecibo.DatBen               = ((TextBox)encabezado.FindControl("datBen")).Text;
                miRecibo.Concepto             = ((TextBox)encabezado.FindControl("concepto")).Text;
                miRecibo.ValorBruto           = Convert.ToDouble(((TextBox)pagos.FindControl("valorBruto")).Text.Substring(1));
                miRecibo.ValorAbonado         = Convert.ToDouble(((TextBox)pagos.FindControl("valorBruto")).Text.Substring(1));
                miRecibo.ValorNeto            = Convert.ToDouble(((TextBox)pagos.FindControl("valorNeto")).Text.Substring(1));
                miRecibo.Almacen              = ((DropDownList)encabezado.FindControl("almacen")).SelectedValue;
                miRecibo.Usuario              = HttpContext.Current.User.Identity.Name.ToString();
                miRecibo.FechaCreacion        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                miRecibo.ClaseRecibo          = Request.QueryString["tipo"];
                miRecibo.PrefijoFactura       = ((DropDownList)pagos.FindControl("ddlPrefijoFactura")).SelectedValue;
                miRecibo.PrefijoNotaCliente   = ((DropDownList)pagos.FindControl("ddlPrefNot")).SelectedValue;
                miRecibo.PrefijoNotaProveedor = ((DropDownList)pagos.FindControl("ddlPrefNotPro")).SelectedValue;
                miRecibo.SqlPagosDev          = (ArrayList)Session["pagosDev"];
                miRecibo.FlujoEspecifico      = (((DropDownList)encabezado.FindControl("ddlFlujo")).SelectedValue.Split('-'))[1].ToString();
                miRecibo.FlujoGeneral         = (((DropDownList)encabezado.FindControl("ddlFlujo")).SelectedValue.Split('-'))[0].ToString();

                if ((Request.QueryString["tipo"] == "RC" || (Request.QueryString["tipo"] == "RP")) && (miRecibo.PrefijoNotaCliente == "" || miRecibo.PrefijoNotaCliente == null))
                {
                    Utils.MostrarAlerta(Response, "Debe seleccionar (parametrizar) un prefijo de Nota Cliente antes de grabar.");
                    return;
                }

                if (Request.QueryString["tipo"] == "CE" && (miRecibo.PrefijoNotaProveedor == "" || miRecibo.PrefijoNotaProveedor == null))
                {
                    Utils.MostrarAlerta(Response, "Debe seleccionar (parametrizar) un prefijo de Nota Proveedor antes de grabar.");
                    return;
                }

                //Validaciones: Causación Obligaciones
                if (Session["TIPO_COMPROBANTE"].ToString().Equals("O"))
                {
                    double totalO = Convert.ToDouble(Session["TOT_OBLIGACION"]);
                    miRecibo.Obligaciones = totalO;
                    if (Math.Abs(miRecibo.ValorBruto - miRecibo.Obligaciones) != 0.0)                // hector diferencia = ceros
                    {
                        Utils.MostrarAlerta(Response, "El valor bruto no es igual al total de las obligaciones");
                        return;
                    }
                    miRecibo.dtObligaciones = (DataTable)Session["DT_OBLIGACIONES"];
                }
                if (miRecibo.Guardar_Recibo())
                {
                    // contabilización ON LINE
                    contaOnline.contabilizarOnline(miRecibo.PrefijoRecibo.ToString(), Convert.ToInt32(miRecibo.NumeroRecibo.ToString()), Convert.ToDateTime(miRecibo.Fecha), "");

                    lb.Text += miRecibo.Mensajes;
                    Session.Clear();
                    string cruce = "";
                    if (Request.QueryString["cruce"] != null)
                    {
                        cruce = "&cruce=1";
                    }
                    if (Request.QueryString["cnd"] != null && Request.QueryString["cnd"] == "1")
                    {
                        Response.Redirect(indexPage + "?process=Tesoreria.EmisionRecibos&cas=1&pre=" + miRecibo.PrefijoRecibo + "&num=" + miRecibo.NumeroRecibo + "&tip=" + Request.QueryString["tipo"] + cruce);
                    }
                    else
                    {
                        Response.Redirect(indexPage + "?process=Tesoreria.EmisionRecibos&pre=" + miRecibo.PrefijoRecibo + "&num=" + miRecibo.NumeroRecibo + "&tip=" + Request.QueryString["tipo"] + cruce);
                    }
                }
                else
                {
                    lb.Text += miRecibo.Mensajes;
                }
            }
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Introducir aquí el código de usuario para inicializar la página
            Ajax.Utility.RegisterTypeForAjax(typeof(AMS_Produccion_EntradasEnsambles));
            if (!Page.IsPostBack)
            {
                DatasToControls bind      = new DatasToControls();
                DateTime        dttFecha  = DateTime.Now;
                DateTime        dttFecha1 = dttFecha.AddMonths(-1);
                DateTime        dttFecha2 = dttFecha.AddMonths(-2);
                DateTime        dttFecha3 = dttFecha.AddMonths(1);
                DateTime        dttFecha4 = dttFecha.AddMonths(2);

                IFormatProvider culture = new System.Globalization.CultureInfo("es-CO", true);
                //bind.PutDatasIntoDropDownList(ddlPrefOrden,"SELECT pdoc_codigo from pdocumento where tdoc_tipodocu='OP';");
                Utils.llenarPrefijos(Response, ref ddlPrefOrden, "%", "%", "OP");
                bind.PutDatasIntoDropDownList(ddlNumOrden, "SELECT mord_numeorde from mordenproduccion where pdoc_codigo='" + ddlPrefOrden.SelectedValue + "' and test_estado='A' and mord_tipo='E';");
                bind.PutDatasIntoDropDownList(ddlLote,
                                              "SELECT mprog_numero from MPROGRAMAPRODUCCION " +
                                              "where (mprog_ano=" + dttFecha.Year + " and mprog_mes=" + dttFecha.Month + ") or " +
                                              "(mprog_ano=" + dttFecha1.Year + " and mprog_mes=" + dttFecha1.Month + ") or " +
                                              "(mprog_ano=" + dttFecha2.Year + " and mprog_mes=" + dttFecha2.Month + ") or " +
                                              "(mprog_ano=" + dttFecha3.Year + " and mprog_mes=" + dttFecha3.Month + ") or " +
                                              "(mprog_ano=" + dttFecha4.Year + " and mprog_mes=" + dttFecha4.Month + ");");
                bind.PutDatasIntoDropDownList(ddlAlmacen, "SELECT PA.palm_almacen, PA.palm_descripcion FROM PALMACEN PA, MPLANTAS MP WHERE PA.palm_almacen=MP.mpla_codigo;");
                bind.PutDatasIntoDropDownList(ddlVendedor, string.Format(Almacen.VENDEDORESPORALMACEN, ddlAlmacen.SelectedValue));
                bind.PutDatasIntoDropDownList(ddlPrefE, string.Format(Documento.DOCUMENTOSTIPOHECHO, "FP", "IP", ddlAlmacen.SelectedValue));
                if (ddlPrefE.Items.Count > 0)
                {
                    txtNumFacE.Text = DBFunctions.SingleData(string.Format(Documento.PROXIMODOCUMENTO, ddlPrefE.SelectedValue));
                }
                else
                {
                    txtNumFacE.Text = "0";
                }

                tbDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

                int mes = DateTime.Now.Month;
                if (mes < 6)
                {
                    txtAno.Text = DBFunctions.SingleData("SELECT PANO_ANO FROM CVEHICULOS;");
                }
                else
                {
                    txtAno.Text = (DateTime.Now.Year + 1).ToString();
                }

                if (Request.QueryString["pref"] != null && Request.QueryString["num"] != null)
                {
                    FormatosDocumentos formatoFactura = new FormatosDocumentos();
                    Utils.MostrarAlerta(Response, "Se ha generado la factura con prefijo " + Request.QueryString["pref"] + " y número " + Request.QueryString["num"] + "");
                    try
                    {
                        formatoFactura.Prefijo = Request.QueryString["pref"];
                        formatoFactura.Numero  = Convert.ToInt32(Request.QueryString["num"]);
                        formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + Request.QueryString["pref"] + "'");
                        if (formatoFactura.Codigo != string.Empty)
                        {
                            if (formatoFactura.Cargar_Formato())
                            {
                                Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                            }
                        }
                    }
                    catch
                    {
                        lbInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                    }
                }
            }

            if (ViewState["COLORES"] == null)
            {
                dtColores = new DataTable();
                dtColores.Columns.Add("PCOL_CODIGO", typeof(string));
                dtColores.Columns.Add("PCOL_DESCRIPCION", typeof(string));
                dtColores.Columns.Add("PCOL_CANTIDAD", typeof(int));
                BindColores();
                ViewState["COLORES"] = dtColores;
            }
            else
            {
                dtColores = (DataTable)ViewState["COLORES"];
            }

            if (ViewState["ENSAMBLES"] != null)
            {
                dtEnsambles = (DataTable)ViewState["ENSAMBLES"];
            }
        }
Exemplo n.º 22
0
        protected void guardar_Click(object sender, System.EventArgs e)
        {
            string cc = (String)Session["CC"];

            if (cc == null)
            {
                cc = DBFunctions.SingleData("SELECT PCEN_CENTCART FROM PALMACEN WHERE PALM_ALMACEN = '" + almacen.SelectedValue + "'");
            }
            ArrayList sqlRefs   = new ArrayList();
            DataTable dtramite  = Session["tablaDatosTramite"] as DataTable;
            DataTable dtDatosTr = Session["tablaDatos"] as DataTable;

            if ((DBFunctions.SingleData("SELECT pven_clave FROM pvendedor WHERE pven_codigo='" + ddlVendedor.SelectedValue + "'") != tbClaveVend.Text.Trim()) || (ddlVendedor.SelectedValue == "0"))
            {
                Utils.MostrarAlerta(Response, "La clave de " + ddlVendedor.SelectedItem.Text + " es invalida.\\nRevise Por Favor!");
                return;
            }

            for (int i = 0; i < dtramite.Rows.Count; i++)
            {
                sqlRefs.Add("INSERT INTO DORDENTRAMITEANULACION VALUES('" + dtramite.Rows[i][0] + "'," + dtramite.Rows[i][1] + ",'" + dtramite.Rows[i][9].ToString() + "', 'C','D','',null, '', '' , null, ''," + dtramite.Rows[i][7].ToString() + ", null, '" + dtramite.Rows[i][6].ToString() + "')");
            }

            numero.Text = DBFunctions.SingleData("SELECT pdoc_ultidocu+1 FROM pdocumento WHERE pdoc_codigo='" + prefijoDocumento.SelectedValue + "'");

            sqlRefs.Add("INSERT INTO mfacturacliente VALUES('" + prefijoDocumento.SelectedValue + "'," + numero.Text.ToString() + ",'" + txtNit.Text + "','" + almacen.SelectedValue + "','N','V'," +
                        "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + Convert.ToDouble(txtvalorServ.Text.Substring(1)) + ", " + Convert.ToDouble(txtivaServ.Text.Substring(1)) + ", " + Convert.ToDouble(txtTotalDoc.Text.Substring(1)) + ", 0" +
                        ", 0, 0, 0, 0,'" + cc + "'," +
                        "'Devolucion Tramite','" + ddlVendedor.SelectedValue + "','" + usuario + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')");

            for (int i = 0; i < dtDatosTr.Rows.Count; i++)
            {
                sqlRefs.Add("INSERT INTO MANULACIONTRAMITE VALUES ('" + prefijoDocumento.SelectedValue + "', " + numero.Text.ToString() + " , '" + dtDatosTr.Rows[i][0] + "', " + dtDatosTr.Rows[i][1] + ")");
                sqlRefs.Add("DELETE FROM MFACTURACLIENTETRAMITE WHERE PDOC_TRAMITE = '" + dtDatosTr.Rows[i][0] + "' AND MORD_NUMEORDE = " + dtDatosTr.Rows[i][1] + "");
                sqlRefs.Add("UPDATE DORDENTRAMITE SET TEST_ESTADO = 'A' WHERE PDOC_CODIGO = '" + dtDatosTr.Rows[i][0] + "' AND MORD_NUMEORDE = " + dtDatosTr.Rows[i][1] + "");
                sqlRefs.Add("UPDATE MORDENTRAMITE SET TEST_ESTADO = 'A' WHERE PDOC_CODIGO = '" + dtDatosTr.Rows[i][0] + "' AND MORD_NUMEORDE = " + dtDatosTr.Rows[i][1] + "");
            }
            sqlRefs.Add("UPDATE PDOCUMENTO SET PDOC_ULTIDOCU = PDOC_ULTIDOCU+1 WHERE PDOC_CODIGO = '" + prefijoDocumento.SelectedValue + "';");

            if (DBFunctions.Transaction(sqlRefs))
            {
                contaOnline.contabilizarOnline(prefijoDocumento.SelectedValue, Convert.ToInt32(numero.Text.ToString()), Convert.ToDateTime(txtFecha.Text), "");
                Utils.MostrarAlerta(Response, "Se ha creado la factura con prefijo " + prefijoDocumento.SelectedValue + " y número " + numero.Text.ToString() + "");
                formatoFactura = new FormatosDocumentos();
                try
                {
                    formatoFactura.Prefijo = prefijoDocumento.SelectedValue;
                    formatoFactura.Numero  = Convert.ToInt32(numero.Text);
                    formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefijo.SelectedValue.ToString() + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + prefijoDocumento.SelectedValue + "','','HEIGHT=600,WIDTH=800');</script>");
                        }
                    }
                    formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + prefijoDocumento.SelectedValue + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=500,WIDTH=700');</script>");
                        }
                    }
                    string indexPage = ConfigurationManager.AppSettings["MainIndexPage"];
                    Session.Clear();
                    Response.Redirect("" + indexPage + "?process=Vehiculos.FacturacionTramite&prefD=" + ddlPrefijo.SelectedValue + "&numD=" + numero.Text + "");
                }
                catch
                {
                    lbInfo.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                }
            }
        }
Exemplo n.º 23
0
        protected void RealizarAsignacion()
        {
            int    maxLista, maxL;
            string tip = "";

            try{ maxLista = Convert.ToInt32(DBFunctions.SingleData("SELECT CINV_TAMLISTEMPA FROM CINVENTARIO;")); }
            catch { maxLista = 0; }

            //Ahora volvemos a recorrer la tabla y creamos las listas de empaque o facturas que se necesiten
            for (int i = 0; i < dtBackOrder.Rows.Count; i++)
            {
                //Primero revisamos si el pedido es de cliente o es tipo trasnferencia
                if (DBFunctions.SingleData("SELECT tped_codigo FROM ppedido WHERE pped_codigo='" + dtBackOrder.Rows[i][4].ToString() + "'") == "T")
                {
                    DataRow[] selection = dtBackOrder.Select("OTRELACIONADA='" + dtBackOrder.Rows[i][14].ToString() + "' AND NIT='" + dtBackOrder.Rows[i][6].ToString() + "' AND ALMACEN='" + dtBackOrder.Rows[i][9].ToString() + "'");
                    string    numTrans  = this.RevisarListaEmpaque(selection);
                    if (numTrans != "")
                    {
                        dtBackOrder.Rows[i][13] = numTrans;
                    }
                    else
                    {
                        //dtBackOrder.Rows[i][13] = "Pendiente";
                        double totalTrans = 0;
                        for (int j = 0; j < selection.Length; j++)
                        {
                            totalTrans += Convert.ToDouble(selection[j][12]);
                        }
                        uint   numeroTransferencia = Convert.ToUInt32(DBFunctions.SingleData("SELECT pdoc_ultidocu+1 FROM pdocumento WHERE pdoc_codigo='" + ddlPrefTrans.SelectedValue + "'"));
                        string codVend             = "";
                        if (rblTipoConsulta.SelectedValue == "OP")
                        {
                            codVend = DBFunctions.SingleData("SELECT pven_codigo FROM mordenproduccion WHERE pdoc_codigo='" + (dtBackOrder.Rows[i][14].ToString().Split('-'))[0] + "' AND mord_numeorde=" + (dtBackOrder.Rows[i][14].ToString().Split('-'))[1] + "");
                            tip     = "OP";
                        }
                        else
                        {
                            codVend = DBFunctions.SingleData("SELECT pven_codigo FROM morden WHERE pdoc_codigo='" + (dtBackOrder.Rows[i][14].ToString().Split('-'))[0] + "' AND mord_numeorde=" + (dtBackOrder.Rows[i][14].ToString().Split('-'))[1] + "");
                            tip     = "OT";
                        }
                        PedidoFactura transferencia = new PedidoFactura(dtBackOrder.Rows[i][6].ToString(), ddlPrefTrans.SelectedValue, numeroTransferencia, DateTime.Now, 0, "", 0, 0, totalTrans, totalTrans, dtBackOrder.Rows[i][9].ToString(), codVend, tip);
                        for (int j = 0; j < selection.Length; j++)
                        {
                            double porcDesc   = Convert.ToDouble(DBFunctions.SingleData("SELECT dped_porcdesc FROM dpedidoitem WHERE pped_codigo='" + selection[j][4].ToString() + "' AND mped_numepedi=" + selection[j][5].ToString() + " AND mite_codigo='" + selection[j][0].ToString() + "'"));
                            double cantPedida = Convert.ToDouble(DBFunctions.SingleData("SELECT dped_cantpedi FROM dpedidoitem WHERE pped_codigo='" + selection[j][4].ToString() + "' AND mped_numepedi=" + selection[j][5].ToString() + " AND mite_codigo='" + selection[j][0].ToString() + "'"));
                            transferencia.InsertaFila(selection[j][0].ToString(), Convert.ToDouble(selection[j][10]), Convert.ToDouble(selection[j][11]), 0, cantPedida, porcDesc, selection[j][3].ToString());
                        }
                        //Ahora realizamos grabamos la transferencia
                        if (transferencia.RealizarFacDir())
                        {
                            dtBackOrder.Rows[i][13] = ddlPrefTrans.SelectedValue + "-" + numeroTransferencia.ToString();
                            rblTipoConsulta.Enabled = lbInfo1.Enabled = tbCodigoItem.Enabled = ddlLinea.Enabled = btnRealizar.Enabled = lbInfo2.Enabled = ddlTipoPedido.Enabled = ddlPrefTrans.Enabled = false;
                            btnReiniciar.Visible    = true;
                            FormatosDocumentos formatoFactura = new FormatosDocumentos();
                            try
                            {
                                formatoFactura.Prefijo = ddlPrefTrans.SelectedValue;
                                formatoFactura.Numero  = (int)numeroTransferencia;
                                formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefTrans.SelectedValue + "'");
                                if (formatoFactura.Codigo != string.Empty)
                                {
                                    if (formatoFactura.Cargar_Formato())
                                    {
                                        Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                                    }
                                }
                            }
                            catch
                            {
                                lb.Text = "Error al generar el formato pedido 1. Detalles : <br>" + formatoFactura.Mensajes;
                            }
                        }
                        else
                        {
                            lb.Text += "<br>Error " + transferencia.ProcessMsg;
                        }
                    }
                }
                else
                {
                    //Aqui debemos revisar si dentro de esta consulta ya existen listas de empaques para este nit en este almacen
                    DataRow[] selection = dtBackOrder.Select("NIT='" + dtBackOrder.Rows[i][6].ToString() + "' AND ALMACEN='" + dtBackOrder.Rows[i][9].ToString() + "'");
                    //Ahora revisamos si ya existe una lista de empaque para este cliente en este almacen
                    string numLis = this.RevisarListaEmpaque(selection);
                    if (numLis != "")
                    {
                        dtBackOrder.Rows[i][13] = numLis;
                    }
                    else
                    {
                        uint         numeroLista    = Convert.ToUInt32(DBFunctions.SingleData("SELECT coalesce(MAX(mlis_numero),0) FROM mlistaempaque")) + 1;
                        ListaEmpaque listaBackOrder = new ListaEmpaque(numeroLista, dtBackOrder.Rows[i][6].ToString(), DateTime.Now, dtBackOrder.Rows[i][9].ToString(), HttpContext.Current.User.Identity.Name.ToLower(), "C", null);
                        maxL = maxLista;
                        if (maxL == 0)
                        {
                            maxL = selection.Length;
                        }
                        for (int j = 0; j < selection.Length && j < maxL; j++)
                        {
                            listaBackOrder.AgregarItem(selection[j][0].ToString(), selection[j][4].ToString(), selection[j][5].ToString(), Convert.ToInt32(selection[j][10]), Convert.ToDouble(selection[j][11]));
                        }
                        //Vamos a almacenar la lista de empaque en la base de datos
                        if (listaBackOrder.AlmacenarLista(true))
                        {
                            dtBackOrder.Rows[i][13] = numeroLista.ToString();
                            ddlNPedido.Enabled      = ddlTPedido.Enabled = rblTipoConsulta.Enabled = lbInfo1.Enabled = tbCodigoItem.Enabled = ddlLinea.Enabled = btnRealizar.Enabled = lbInfo2.Enabled = ddlTipoPedido.Enabled = ddlPrefTrans.Enabled = false;
                            btnReiniciar.Visible    = true;
                        }
                        else
                        {
                            lb.Text += "<br><br>Error : " + listaBackOrder.ProcessMsg;
                        }
                    }
                }
            }
            BindDgBackOrder();
        }
Exemplo n.º 24
0
        protected void Recepcionar_Alquiler(object sender, EventArgs e)
        {
            bool seleccionado = false;

            seleccionado = ((CheckBox)grillaElementos.Items[0].Cells[8].FindControl("cbRows")).Checked;
            if (seleccionado == false)
            {
                Utils.MostrarAlerta(Response, "No ha seleccionado Activos para recepcionar. Verifique por favor!"); return;
            }
            ArrayList sqlRefs     = new ArrayList();
            DataTable dtElementos = Session["tablaAlq"] as DataTable;

            if ((DBFunctions.SingleData("SELECT pven_clave FROM pvendedor WHERE pven_codigo='" + ddlVendedor.SelectedValue + "'") != tbClaveVend.Text.Trim()) || (ddlVendedor.SelectedValue == "0"))
            {
                Utils.MostrarAlerta(Response, "La clave de " + ddlVendedor.SelectedItem.Text + " es invalida.\\nRevise Por Favor!");
                return;
            }
            for (int j = 0; j < dtElementos.Rows.Count; j++)
            {
                seleccionado = ((CheckBox)grillaElementos.Items[j].Cells[8].FindControl("cbRows")).Checked;
                if (seleccionado)
                {
                    sqlRefs.Add("UPDATE MALQUILERACTIVOS SET TEST_ESTADO = 1 WHERE MAFJ_CODIACTI = '" + dtElementos.Rows[j][0] + "'");
                    sqlRefs.Add("UPDATE DORDENALQUILER SET DORD_PROCESO = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' WHERE PDOC_CODIGO = '" + ddlFactura.SelectedValue + "' AND MORD_NUMEORDE = " + ddlNumFac.SelectedValue + " AND MAFJ_CODIACTI = '" + dtElementos.Rows[j][0] + "'");
                }
            }

            if (DBFunctions.Transaction(sqlRefs))
            {
                Utils.MostrarAlerta(Response, "Se ha recepcionado el activo con prefijo " + ddlPrefijoI.SelectedValue.ToString() + " y número " + txtNumeroI.Text.ToString() + "");
                formatoFactura = new FormatosDocumentos();
                try
                {
                    formatoFactura.Prefijo = ddlPrefijoI.SelectedValue.ToString();
                    formatoFactura.Numero  = Convert.ToInt32(txtNumeroI.Text);
                    formatoFactura.Codigo  = DBFunctions.SingleData("SELECT sfor_codigo FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefijoI.SelectedValue + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=600,WIDTH=800');</script>");
                        }
                    }
                    formatoFactura.Codigo = DBFunctions.SingleData("SELECT sfor_codigo2 FROM dbxschema.pdocumento WHERE pdoc_codigo='" + ddlPrefijoI.SelectedValue + "'");
                    if (formatoFactura.Codigo != string.Empty)
                    {
                        if (formatoFactura.Cargar_Formato())
                        {
                            Response.Write("<script language:javascript>w=window.open('" + formatoFactura.Documento + "','','HEIGHT=500,WIDTH=700');</script>");
                        }
                    }
                    string indexPage = ConfigurationManager.AppSettings["MainIndexPage"];
                    Session.Clear();
                    Response.Redirect("" + indexPage + "?process=Vehiculos.RecepcionAlquiler&prefD=" + ddlPrefijoI.SelectedValue + "&numD=" + txtNumeroI.Text + "");
                }
                catch
                {
                    lberror.Text = "Error al generar el formato. Detalles : <br>" + formatoFactura.Mensajes;
                }
            }
            else
            {
                lberror.Text = "Error ejecutando:" + DBFunctions.exceptions;
            }
        }