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

            if (Rbnreciboingreso.Checked)
            {
                Reporte_General.CXC.cxcrepcobro01 Reporte_Recibo_Ingreso = new Reporte_General.CXC.cxcrepcobro01();

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

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

                if (opcion == "Imprimir")
                {
                    Reporte_Recibo_Ingreso.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_Recibo_Ingreso.reportViewer1);
                    mail.Attachments.Add(new Attachment(ruta));
                }
            }
            else
            {
                Reporte_General.CXC.cxcrepcobroadelantadodetalle01 Reporte_Recibo_Ingreso = new Reporte_General.CXC.cxcrepcobroadelantadodetalle01();

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

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

                if (opcion == "Imprimir")
                {
                    Reporte_Recibo_Ingreso.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_Recibo_Ingreso.reportViewer1);
                    mail.Attachments.Add(new Attachment(ruta));
                }
            }
        }
Example #2
0
        protected override void Imprimir()
        {
            base.Imprimir();
            if (Rbnreciboingreso.Checked)
            {
                var Reporte_Recibo_Ingreso = new Reporte_General.CXC.cxcrepcobro01();
                Reporte_Recibo_Ingreso._id = _secuencia;
                if (_nulo == false)
                {
                    Reporte_Recibo_Ingreso._Letrero_Copia = "COPIA";
                }
                else
                {
                    Reporte_Recibo_Ingreso._Letrero_Copia = "<<NULO>> COPIA";
                }

                Reporte_Recibo_Ingreso.Show();
                Reporte_Recibo_Ingreso.Owner = this;
            }
            else
            {
                var Reporte_Registro = new Reporte_General.CXC.cxcrepcobroadelantadodetalle01();
                Reporte_Registro._id = _secuencia;
                if (_nulo == false)
                {
                    Reporte_Registro._Letrero_Copia = "COPIA";
                }
                else
                {
                    Reporte_Registro._Letrero_Copia = "<<NULO>> COPIA";
                }

                Reporte_Registro.Show();
                Reporte_Registro.Owner = this;
            }
        }
        protected void Fun_Procesar_Salvar(string cmd2)
        {
            Control[] array = { Txtcodigocliente, Txtaplicar, Cmbmoneda };

            if (!Funciones.Fun_Validar_Campos_Vacios(array))
            {
                string encabezado     = "";
                string detalle        = "";
                string cierre         = "";
                string xml            = "";
                double balancecliente = Funciones.Fun_Convierte_String_aDecimal(Txtbalance.Text) - Funciones.Fun_Convierte_String_aDecimal(Txtaplicar.Text);
                double total          = Funciones.Fun_Convierte_String_aDecimal(Txtaplicar.Text) - Funciones.Fun_Convierte_String_aDecimal(Txtcargdesc.Text);

                encabezado = "<Cobro dfecha = \"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha)
                             + "\" nidcliente =\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigocliente.Text)
                             + "\" creferencia =\"" + Txtreferencia.Text
                             + "\" ntotal =\"" + total
                             + "\" nbalancecliente =\"" + balancecliente
                             + "\" ccomentario =\"" + " "
                             + "\" ntotalcomision =\"" + 0
                             + "\" ntasamoneda =\"" + tasamoneda
                             + "\" ntotalretencionisr =\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotalretencionisr.Text)
                             + "\" ntotalretencionitbis =\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotalretencionitbis.Text)
                             + "\" ntotalcargo =\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotalcargo.Text)
                             + "\" ntotaldescuento =\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotaldescuento.Text)
                             + "\" nidvendedor =\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigovendedor.Text)
                             + "\" nidmoneda =\"" + Cmbmoneda.SelectedValue
                             + "\" nidcierrecaja =\"" + 0


                             + "\"> <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 nidregistro =\"" + Funciones.Fun_Convierte_String_aEntrero(item.Cells["dgvidregistro"].Value + "")
                                      + "\" nmonto =\"" + Funciones.Fun_Convierte_String_aDecimal(item.Cells["dgvaplicar"].Value + "")
                                      + "\" nmontoretencionisr =\"" + Funciones.Fun_Convierte_String_aDecimal(item.Cells["dgvretencionisr"].Value + "")
                                      + "\" nmontoretencionitbis =\"" + Funciones.Fun_Convierte_String_aDecimal(item.Cells["dgvretencionitbis"].Value + "")
                                      + "\" ncargo =\"" + Funciones.Fun_Convierte_String_aDecimal(item.Cells["dgvcargo"].Value + "")
                                      + "\" ndescuento =\"" + Funciones.Fun_Convierte_String_aDecimal(item.Cells["dgvdescuento"].Value + "")
                                      + "\"/>";
                        }
                    }
                }

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

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


                    string  cmdpago = string.Format("exec Spr_gen_pago '{0}','{1}','{2}','{3}','{4}'", Properties.Settings.Default.idsesion, 1, ds.Tables[1].Rows[0][0].ToString(), Funciones_Duke4.Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha), cmd2);
                    DataSet ds2     = FuncionesSQL.Fun_Sql_Ejecutar(cmdpago);
                    if (Ckbimprimir.Checked)
                    {
                        var reporte = new Reporte_General.CXC.cxcrepcobro01();
                        reporte._id = ds.Tables[1].Rows[0][0].ToString();


                        reporte.Show();
                        reporte.Owner = this;
                    }
                }
                else if (Rbnaplicardeposito.Checked)
                {
                    string  cmd = string.Format("exec Spr_cxc_cobro_deposito '{0}','{1}','{2}'", Properties.Settings.Default.idsesion, 1, xml); //Armo el comando
                    DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);



                    if (Ckbimprimir.Checked)
                    {
                        var Reporte = new Reporte_General.CXC.cxcrepcobroadelantadodetalle01();
                        Reporte._id = ds.Tables[0].Rows[0][0].ToString();


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

                Funciones.Fun_Limpiar_Formulario(MainPanel);
                Txtcobro.Text            = FuncionesSQL.Fun_SQL_Buscar_UltimoNumReg("Cobro");
                Txtcodigocliente.Enabled = true;
                Ckbimprimir.Checked      = true;
                LblAlerta.Text           = "";
            }
            else
            {
                LblAlerta.Text = Mensajes.Stg_Campos_EnBlanco;
            }
        }