예제 #1
0
        protected override void Imprimir()
        {
            base.Imprimir();

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

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

            if (Rbncredito.Checked)
            {
                Reporte._titulonota = "NOTA DE CREDITO";
            }
            else if (Rbndebito.Checked)
            {
                Reporte._titulonota = "NOTA DE DEBITO";
            }

            Reporte.Show();
            Reporte.Owner = this;
        }
예제 #2
0
        protected void GeneraReporte(string opcion, int pos, bool nulo)
        {
            string ruta      = "";
            string nombredoc = "";

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

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

            if (Rbncredito.Checked)
            {
                Reporte._titulonota = "NOTA DE CREDITO";
            }
            else if (Rbndebito.Checked)
            {
                Reporte._titulonota = "NOTA DE DEBITO";
            }

            Reporte._id = gridBase1.Rows[pos].Cells["dgvidregistro"].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));
            }
        }
예제 #3
0
        protected override void Salvar()
        {
            base.Salvar();

            Control[] array  = { Txtcodigocliente, Txtconcepto, Txtcodigovendedor, Txttotal, Cmbmoneda };
            double    balcli = 0;

            int    tiponota   = 0;
            int    idncf      = 0;
            string titulonota = "";

            if (Rbncredito.Checked)
            {
                tiponota   = 1;
                idncf      = 4;
                titulonota = "NOTA DE CREDITO";
            }
            else if (Rbndebito.Checked)
            {
                tiponota   = 2;
                idncf      = 3;
                titulonota = "NOTA DE DEBITO";
            }

            if (!Funciones.Fun_Validar_Campos_Vacios(array))
            {
                if (Funciones.Fun_Convierte_String_aDecimal(Txttotal.Text) > 0)
                {
                    string encabezado     = "";
                    string detalle        = "";
                    string cierre         = "";
                    string xml            = "";
                    double balancecliente = Funciones.Fun_Convierte_String_aDecimal(Txtbalance.Text) - Funciones.Fun_Convierte_String_aDecimal(Txttotal.Text);

                    encabezado = "<Debcre dfecha = \"" + Funciones.Fun_Convertir_Fecha_FormatoyyyMMdd(Dtpfecha)
                                 + "\" nidcliente =\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigocliente.Text)
                                 + "\" creferencia =\"" + Txtreferencia.Text
                                 + "\" cconcepto =\"" + Txtconcepto.Text
                                 + "\" nitbis =\"" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(Txtitbis.Text)
                                 + "\" ntotal =\"" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(Txttotal.Text)
                                 + "\" nbalancecliente =\"" + balancecliente
                                 + "\" nidvendedor =\"" + Funciones.Fun_Convierte_String_aEntrero(Txtcodigovendedor.Text)
                                 + "\" cncf =\"" + Mskncf.Text
                                 + "\" nidmoneda =\"" + Cmbmoneda.SelectedValue
                                 + "\" ntiponota =\"" + tiponota
                                 + "\" ngravado =\"" + gravado
                                 + "\" nexento =\"" + exento

                                 + "\"> <Facturas>";

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

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

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

                    if (Ckbncf.Checked == true)
                    {
                        FuncionesSQL.Fun_SQL_Actualizar_NCF(idncf);
                    }



                    if (Ckbimprimir.Checked == true)
                    {
                        var Reporte = new Reporte_General.CXC.cxcrepdebcre01();

                        if (tiponota == 1)
                        {
                            Reporte._titulonota = "NOTA DE CREDITO";
                        }
                        else if (tiponota == 2)
                        {
                            Reporte._titulonota = "NOTA DE DEBITO";
                        }

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

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

                    Funciones.Fun_Limpiar_Formulario(MainPanel);

                    if (tiponota == 1)
                    {
                        Txtregistro.Text = FuncionesSQL.Fun_SQL_Buscar_UltimoNumReg("NOTA DE CREDITO CXC");
                    }
                    else
                    {
                        Txtregistro.Text = FuncionesSQL.Fun_SQL_Buscar_UltimoNumReg("NOTA DE DEBITO CXC");
                    }

                    Txtcodigocliente.Enabled = true;
                    Ckbimprimir.Checked      = true;
                    Ckbncf.Checked           = true;
                    Rbncredito.Checked       = true;

                    LblAlerta.Text = "";
                }
                else
                {
                    if (tiponota == 1)
                    {
                        LblAlerta.Text = "Seleccione Factura a Aplicar Nota de Crédito    ";
                    }
                    else if (tiponota == 2)
                    {
                        LblAlerta.Text = "Seleccione Factura a Aplicar Nota de Débito    ";
                    }
                }
            }
            else
            {
                LblAlerta.Text = Logistica.Mensajes.Stg_Campos_EnBlanco;
            }
        }