protected void GeneraReporte(string opcion, int pos, bool nulo)
        {
            string ruta      = "";
            string nombredoc = "";

            Reporte_General.CXC.cxcrepchequefuturo01 Reporte = new Reporte_General.CXC.cxcrepchequefuturo01();

            if (nulo == false)
            {
                Reporte._Letrero_Copia = "COPIA";
            }
            else
            {
                Reporte._Letrero_Copia = "<<NULO>> COPIA";
            }

            Reporte._id = gridBase1.Rows[pos].Cells["dgvidchequefuturo"].Value.ToString();
            Reporte.Fun_Reporte();

            if (opcion == "Imprimir")
            {
                Reporte.Show();
            }
            else if (opcion == "Enviar")
            {
                nombredoc = gridBase1.Rows[pos].Cells["dgvsecuencia"].Value.ToString() + "-" + System.DateTime.Now.ToString("yyyyMMdd");
                ruta      = Funciones_Duke4.Funciones.Fun_Exportar_aPDF(@"C:\Reporte_Duke4\Reporte_CxC\Registros_Facturas\", nombredoc + ".pdf", Reporte.reportViewer1);
                mail.Attachments.Add(new Attachment(ruta));
            }
        }
Example #2
0
        protected override void Imprimir()
        {
            base.Imprimir();

            var Reporte = new Reporte_General.CXC.cxcrepchequefuturo01();

            Reporte._id = _secuencia;
            if (_nulo == false)
            {
                Reporte._Letrero_Copia = "COPIA";
            }
            else
            {
                Reporte._Letrero_Copia = "<<NULO>> COPIA";
            }

            Reporte.Show();
            Reporte.Owner = this;
        }
        protected override void Salvar()
        {
            base.Salvar();
            Control[] array = { Txtchequefuturo, Txtcodigocliente, Txtcodigovendedor, Txtaplicar, Cmbmoneda, Dgv, Txtnock, Dtpfechadeposito, Cmbbanco };

            if (!Funciones.Fun_Validar_Campos_Vacios(array))
            {
                string encabezado = "";
                string detalle    = "";
                string cierre     = "";
                string xml        = "";

                encabezado = "<ChequesFuturos csecuencia=\"" + Txtchequefuturo.Text
                             + "\" dfecha=\"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha)
                             + "\" creferencia=\"" + Txtreferencia.Text
                             + "\" nidcliente=\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigocliente.Text)
                             + "\" nidvendedor=\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigovendedor.Text)
                             + "\" nidbanco=\"" + Cmbbanco.SelectedValue
                             + "\" nnocheque=\"" + Funciones.Fun_Convierte_String_aEntrero(Txtnock.Text)
                             + "\" dfechadeposito=\"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfechadeposito)
                             + "\" ntotal=\"" + Funciones.Fun_Convierte_String_aDecimal(Txtaplicar.Text)
                             + "\" nbalancecliente =\"" + Funciones.Fun_Convierte_String_aDecimal(Txtbalance.Text)
                             + "\" nidmoneda=\"" + Cmbmoneda.SelectedValue

                             + "\"> <Facturas>";


                foreach (DataGridViewRow item in Dgv.Rows)
                {
                    if (Convert.ToBoolean(item.Cells[""].EditedFormattedValue))
                    {
                        if (Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvaplicar"].Value)) > 0)
                        {
                            detalle = detalle + "<Factura nidfactura=\"" + Funciones.Fun_Convierte_String_aEntrero(Convert.ToString(item.Cells["dgvidregistro"].Value))
                                      + "\" nmonto=\"" + Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvaplicar"].Value))
                                      + "\"/>";
                        }
                    }
                }


                cierre = "</Facturas> </ChequesFuturos>";
                xml    = encabezado + detalle + cierre;

                string  cmd = string.Format("exec Spr_cxc_chequefuturo '{0}','{1}','{2}'", Properties.Settings.Default.idsesion, 1, xml); //Armo el comando
                DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);

                if (Ckbimprimir.Checked)
                {
                    var Reporte_ChequeFuturo = new Reporte_General.CXC.cxcrepchequefuturo01();

                    Reporte_ChequeFuturo._id = ds.Tables[1].Rows[0][0].ToString();

                    Reporte_ChequeFuturo.Show();
                    Reporte_ChequeFuturo.Owner = this;
                }

                Funciones.Fun_Limpiar_Formulario(MainPanel);


                Txtchequefuturo.Text = FuncionesSQL.Fun_SQL_Buscar_UltimoNumReg("CHEQUE FUTURO");


                Ckbimprimir.Checked = true;

                LblAlerta.Text = "";
            }
            else
            {
                LblAlerta.Text = Mensajes.Stg_Campos_EnBlanco;
            }
        }