Ejemplo n.º 1
0
        private void NotaDeDébitoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            notaDeDébitoToolStripMenuItem.Enabled = false;
            ListaNotaDebito Check = new ListaNotaDebito();

            Check.Show();
        }
Ejemplo n.º 2
0
        private void btn_Regresar_Click(object sender, EventArgs e)
        {
            this.Hide();
            ListaNotaDebito.operacionFactura = "Q";
            ListaNotaDebito Check = new ListaNotaDebito();

            Check.Show();
        }
Ejemplo n.º 3
0
        public ListaNotaDebito()
        {
            InitializeComponent();
            this.ControlBox = false;
            this.Text       = "NOTA DÉBITO";
            formListaDebito = this;
            objMoneda       = new MonedaDAO();
            gridParams();
            objDocumentoDao = new DocumentoDAO();
            DateTime d1, d2;

            d2 = DateTime.Now;
            d1 = new DateTime(d2.Year, d2.Month, 1);
            dpickerInicio.Value     = d1;
            objListaDocumentoCab    = objDocumentoDao.listarCabecera(d1, d2, txt_Ruc.Text, "08", Ventas.UNIDADNEGOCIO);
            grd_Facturas.DataSource = objListaDocumentoCab;
            grd_Facturas.Refresh();
            grd_Facturas.CellClick += Grd_Facturas_CellClick;
        }
Ejemplo n.º 4
0
 public MotivoAnulacion(String tipo)
 {
     InitializeComponent();
     objDocumentoDao = new DocumentoDAO();
     cargarCombo();
     tipoDocu = tipo;
     if (tipo == "F")
     {
         formFac = ListaFactura.formListaFactura;
     }
     else if (tipo == "B")
     {
         formBol = ListaBoleta.formListaBoleta;
     }
     else if (tipo == "C")
     {
         formCred = ListaNotaCredito.formListaCredito;
     }
     else if (tipo == "D")
     {
         formDeb = ListaNotaDebito.formListaDebito;
     }
 }
Ejemplo n.º 5
0
        private void btn_SaveData_Click(object sender, EventArgs e)
        {
            btn_SaveData.Enabled = false;
            for (int i = 0; i < objListDocumentoDet.Count; i++)
            {
                objListDocumentoDet[i].DocumentoCabSerie = txt_Serie.Text;
                objListDocumentoDet[i].DocumentoCabNro   = txt_Numero.Text;
            }
            bool binsertar, bupdate, bdetalle = true;

            objDocumentoCab = new DocumentoCab();
            objDocumentoCab.DocumentoCabSerie          = txt_Serie.Text;
            objDocumentoCab.DocumentoCabNro            = txt_Numero.Text;
            objDocumentoCab.DocumentoCabClienteCod     = txt_codcliente.Text;
            objDocumentoCab.DocumentoCabFecha          = dpick_Fecha.Value;
            objDocumentoCab.DocumentoCabGlosa          = txt_GlosaCab.Text;
            objDocumentoCab.DocumentoCabIGV            = convertToDouble(txt_IGV.Text);
            objDocumentoCab.DocumentoCabTotalSinIGV    = convertToDouble(txt_ValorVenta.Text);
            objDocumentoCab.DocumentoCabTotal          = convertToDouble(txt_TotalPagar.Text);
            objDocumentoCab.DocumentoCabTipoDoc        = "08";
            objDocumentoCab.DocumentoCabTipoPago       = 1;
            objDocumentoCab.DocumentoCabTipoNotaDebito = cmb_Motivo.SelectedValue.ToString();
            objDocumentoCab.DocumentoCabTipoMoneda     = cmb_Moneda.SelectedValue.ToString();

            objDocumentoCab.DocumentoCabNroRef      = txt_NumeroBuscar.Text;
            objDocumentoCab.DocumentoCabSerieRef    = txt_SerieBuscar.Text;
            objDocumentoCab.DocumentoCabTipoDocRef  = "01";
            objDocumentoCab.DocumentoCabFechaDocRef = dpck_Fechadcto.Value;

            objDocumentoCab.DocumentoCabUsuAdd    = Ventas.UsuarioSession;
            objDocumentoCab.DocumentoCabFechaVcto = new DateTime(2000, 1, 1);
            if (Modificar == "G")
            {
                binsertar = objDocumento.insertarCabecera(objDocumentoCab, Ventas.UNIDADNEGOCIO);
                string msg = "";
                if (binsertar)
                {
                }
                else
                {
                    msg = "Hubo un problema al guardar";
                    MessageBox.Show(msg);
                    btn_SaveData.Enabled = true;

                    return;
                }
                for (int i = 0; i < objListDocumentoDet.Count; i++)
                {
                    bdetalle = objDocumento.insertDetalle(objListDocumentoDet[i]);
                    if (bdetalle == false)
                    {
                        MessageBox.Show("Error al guardar");
                        btn_SaveData.Enabled = true;
                        break;
                    }
                }
                if (bdetalle)
                {
                    MessageBox.Show("Nota de Crédito Guardada exitosamente");

                    btn_SaveData.Enabled = true;
                }
                DialogResult dialogResult = MessageBox.Show("Enviar a Sunat?", "ENVIAR DOCUMENTOS", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    objDocumentoElectronicoCab     = objDocumento.getDocumentoElectronicoCab(txt_Serie.Text, txt_Numero.Text, Ventas.UNIDADNEGOCIO);
                    objListDocumentoElectronicoDet = objDocumento.getDocumentoElectronicoDet(txt_Serie.Text, txt_Numero.Text, Ventas.UNIDADNEGOCIO);
                    String rutatext = objProceso.generarText(objDocumentoElectronicoCab, objListDocumentoElectronicoDet);
                    String mess     = objProceso.sendTxt(rutatext);

                    String   mensajeMostrar = "";
                    String[] array          = mess.Split('|');

                    List <String> objListaString = array.ToList();
                    if (objListaString.Count < 10)
                    {
                        mensajeMostrar = objListaString[1];
                        objDocumento.updateObservacionSunat(txt_Serie.Text, txt_Numero.Text, mensajeMostrar);
                        //objDocumento.updateEstadoAnulado(txt_Serie.Text, txt_Numero.Text);
                    }
                    else
                    {
                        mensajeMostrar = objListaString[9];
                        if (mensajeMostrar == "true")
                        {
                            mensajeMostrar = "Documento Enviado";
                            objDocumento.updateObservacionSunat(txt_Serie.Text, txt_Numero.Text, mensajeMostrar);
                            //objDocumento.updateEstadoAceptado(txt_Serie.Text, txt_Numero.Text);
                            objDocumento.updateEstadoEnviado(txt_Serie.Text, txt_Numero.Text);
                        }
                        else
                        {
                            objDocumento.updateObservacionSunat(txt_Serie.Text, txt_Numero.Text, mensajeMostrar);
                        }
                    }


                    MessageBox.Show(mensajeMostrar);
                }
                else if (dialogResult == DialogResult.No)
                {
                    //do something else
                }
            }
            else
            {
                bupdate = objDocumento.updateCabecera(objDocumentoCab);
                string msg = "";
                if (bupdate)
                {
                }
                else
                {
                    msg = "Hubo un problema al guardar";
                    MessageBox.Show(msg);
                    btn_SaveData.Enabled = true;
                    return;
                }
                for (int i = 0; i < objListDocumentoDet.Count; i++)
                {
                    bupdate = objDocumento.updateDetalle(objListDocumentoDet[i]);
                    if (bupdate == false)
                    {
                        MessageBox.Show("Error al guardar");
                        btn_SaveData.Enabled = true;
                        break;
                    }
                }
                if (bupdate)
                {
                    MessageBox.Show("Nota de Débito Guardada exitósamente");

                    btn_SaveData.Enabled = true;
                }

                btn_SaveData.Enabled = true;
            }
            // nuevoRegistro();
            this.Hide();
            ListaNotaDebito.operacionFactura = "Q";
            ListaNotaDebito Check = new ListaNotaDebito();

            Check.Show();
        }