예제 #1
0
        protected void GeneraReporte(string opcion, int pos, bool nulo)
        {
            string ruta = "";
            string nombredoc = "";
            Reporte_General.CXC.cxcrepchequedevuelto01 Reporte_Registro = new Reporte_General.CXC.cxcrepchequedevuelto01();

            if (nulo == false)
                Reporte_Registro._Letrero_Copia = "COPIA";
            else
                Reporte_Registro._Letrero_Copia = "<<NULO>> COPIA";

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

            if (opcion == "Imprimir")
            {
                Reporte_Registro.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_Registro.reportViewer1);
                mail.Attachments.Add(new Attachment(ruta));
            }
        }
        public bool _nulo        = false; protected override void Imprimir()
        {
            base.Imprimir();
            var Reporte = new Reporte_General.CXC.cxcrepchequedevuelto01();

            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 = { Txtchequedevuelto, Txtcodigocliente, Cmbmoneda, Txtmonto, Cmbcuenta, Txtnock, Cmbbanco };

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

                encabezado = "<Registros csecuencia=\"" + Txtchequedevuelto.Text
                             + "\" dfecha=\"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha)
                             + "\" creferencia=\"" + Txtnock.Text
                             + "\" nidcliente=\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigocliente.Text)
                             + "\" ntotal=\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotal.Text)
                             + "\" nbalance=\"" + Funciones.Fun_Convierte_String_aDecimal(Txttotal.Text)
                             + "\" ntotalitbis=\"" + 0
                             + "\" ntotalexento=\"" + 0
                             + "\" ntotalgravado16=\"" + 0
                             + "\" ntotalgravado18=\"" + 0
                             + "\" ntotaldescuentoporciento=\"" + 0
                             + "\" ntotaldescuentomonto=\"" + 0
                             + "\" ntotalimporte=\"" + Funciones.Fun_Convierte_String_aDecimal(Txtmonto.Text)
                             + "\" dfechavencimiento=\"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha)
                             + "\" nidvendedor=\"" + 1
                             + "\" cncf=\"" + ""
                             + "\" nidcontabilidad=\"" + 0
                             + "\" nidmoneda=\"" + Cmbmoneda.SelectedValue
                             + "\" ccomentario=\"" + Txtconcepto.Text
                             + "\" nbalancecliente =\"" + Funciones.Fun_Convierte_String_aDecimal(Txtbalance.Text)
                             + "\" ntiporegistro =\"" + 2
                             + "\" ntotalcargo =\"" + Funciones.Fun_Convierte_String_aDecimal(Txtcargo.Text)
                             + "\" nidbanco =\"" + Cmbbanco.SelectedValue
                             + "\" nidcuentabancaria =\"" + Cmbcuenta.SelectedValue

                             + "\"> <Facturas>";



                detalle = detalle + "<Factura nidconcepto=\"" + 0
                          + "\" cdescripcion=\"" + "CHEQUE DEVUELTO"
                          + "\" ncantidad=\"" + 1
                          + "\" nprecio=\"" + Funciones.Fun_Convierte_String_aDecimal(Txtmonto.Text)
                          + "\" ndescuentomonto=\"" + 0
                          + "\" ndescuentoporciento=\"" + 0
                          + "\" nmontoitbis=\"" + 0
                          + "\" nmontoexento=\"" + 0
                          + "\" nmontogravado16=\"" + 0
                          + "\" nmontogravado18=\"" + 0
                          + "\" nmontoimporte=\"" + Funciones.Fun_Convierte_String_aDecimal(Txtmonto.Text)
                          + "\" norden=\"" + 1
                          + "\" nmontocargo=\"" + Funciones.Fun_Convierte_String_aDecimal(Txtcargo.Text)
                          + "\"/>";


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

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

                if (Ckbimprimir.Checked)
                {
                    var Reporte_Cheque_Devuelto = new Reporte_General.CXC.cxcrepchequedevuelto01();
                    if (_OpcionSQL == "Modificar")
                    {
                        Reporte_Cheque_Devuelto._id = ds.Tables[0].Rows[0][0].ToString();
                    }
                    else
                    {
                        Reporte_Cheque_Devuelto._id = ds.Tables[1].Rows[0][0].ToString();
                    }

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

                Funciones.Fun_Limpiar_Formulario(MainPanel);

                if (_OpcionSQL == "Insertar")
                {
                    Crear();
                }

                else
                {
                    Modificar();
                }

                Ckbimprimir.Checked = true;

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