Exemplo n.º 1
0
 private void CargaNotaSalida()
 {
     try
     {
         venta = AdmVenta.CargaFacturaVenta(CodNotaS);
         if (venta != null)
         {
             txtDocRef.Text          = venta.SiglaDocumento + " - " + venta.Serie + " - " + venta.NumDoc;
             txtTipoCambio.Text      = venta.TipoCambio.ToString();
             cmbMoneda.SelectedValue = venta.Moneda;
             if (txtCodCliente.Enabled)
             {
                 CodCliente            = venta.CodCliente;
                 cli                   = AdmCli.MuestraCliente(CodCliente);
                 txtCodCliente.Text    = cli.RucDni;
                 txtNombreCliente.Text = cli.Nombre;
             }
             CargaDetalleNota();
         }
         else
         {
             MessageBox.Show("El documento solicitado no existe", "Nota de Credito", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         return;
     }
 }
Exemplo n.º 2
0
 private void txtDocRef_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F1)
     {
         if (Application.OpenForms["frmListaDocumentosPorCliente"] != null)
         {
             Application.OpenForms["frmListaDocumentosPorCliente"].Activate();
         }
         else
         {
             frmListaDocumentosPorCliente form = new frmListaDocumentosPorCliente();
             form.Text       = "Documentos";
             form.CodCliente = CodCliente;
             form.tipo       = 2;
             form.ShowDialog();
             if (form.venta != null && form.venta.CodFacturaVenta != "")
             {
                 venta = form.venta; CodNotaS = Convert.ToInt32(venta.CodFacturaVenta);
             }
             else
             {
             }
             if (CodNotaS != 0)
             {
                 CargaNotaSalida(); ProcessTabKey(true);
             }
         }
     }
 }
Exemplo n.º 3
0
 private void CargaCuentaxCobrar()
 {
     venta = AdmVenta.CargaFacturaVenta(Convert.ToInt32(venta.CodFacturaVenta));
     txtCodCliente.Text         = venta.DNI;
     txtNombreProveedor.Text    = venta.RazonSocialCliente;
     cmbFormaPago.SelectedValue = venta.FormaPago;
     fpago                   = AdmPago.CargaFormaPago(Convert.ToInt32(cmbFormaPago.SelectedValue));
     txtMonto.Text           = String.Format("{0:#,##0.00}", venta.Total);
     cmbMoneda.SelectedValue = venta.Moneda;
     txtTipoCambio.Text      = venta.TipoCambio.ToString();
     documento               = venta.SiglaDocumento + "-" + venta.Serie + "-" + venta.NumDoc;
 }
Exemplo n.º 4
0
 public Boolean updateCobroVenta(clsFacturaVenta venta)
 {
     try
     {
         return(Mventa.updateCobroVenta(venta));
     }
     catch (Exception ex)
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message,
                                                   "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
 }
Exemplo n.º 5
0
        private void CargaFacturaVenta()
        {
            try
            {
                venta = AdmVenta.CargaFacturaVenta(Convert.ToInt32(CodNota));
                ser   = AdmSerie.MuestraSerie(venta.CodSerie, frmLogin.iCodAlmacen);
                if (venta != null)
                {
                    if (venta.DocumentoReferencia != null)
                    {
                        notaS = AdmNotaS.CargaNotaSalidaDebitoVentas(Convert.ToInt32(venta.CodFacturaVenta));
                    }

                    txtNumDoc.Text = venta.CodFacturaVenta;
                    CodNotaS       = Convert.ToInt32(venta.CodFacturaVenta);
                    CodTransaccion = venta.CodTipoTransaccion;
                    CargaTransaccion();

                    CodCliente = notaS.CodCliente;
                    CargaCliente();

                    dtpFecha.Value          = venta.FechaSalida;
                    cmbMoneda.SelectedValue = venta.Moneda;
                    txtTipoCambio.Text      = venta.TipoCambio.ToString();
                    cmbMotivo.SelectedItem  = venta.Motivo.ToString();
                    txtComentario.Text      = venta.Comentario.ToString();
                    if (txtDocRef.Enabled)
                    {
                        CodDocumento   = venta.CodTipoDocumento;
                        txtDocRef.Text = notaS.SiglaDocumento + " " + notaS.Serie + "-" + notaS.NumDoc;
                    }
                    txtBruto.Text       = String.Format("{0:#,##0.00}", venta.MontoBruto);
                    txtDscto.Text       = String.Format("{0:#,##0.00}", venta.MontoDscto);
                    txtValorVenta.Text  = String.Format("{0:#,##0.00}", venta.Total - venta.Igv);
                    txtIGV.Text         = String.Format("{0:#,##0.00}", venta.Igv);
                    txtPrecioVenta.Text = String.Format("{0:#,##0.00}", venta.Total);
                    DetalleFacturaVenta();
                }
                else
                {
                    MessageBox.Show("El documento solicitado no existe", "Nota de Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                return;
            }
        }
Exemplo n.º 6
0
        public Boolean insertventaentregar(clsFacturaVenta venta)
        {
            try
            {
                return(Mventa.insertventaentregar(venta));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Duplicate entry"))
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message,
                                                          "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult = MessageBox.Show("¿ Al liquidar la entrega esta será cerrada y no podra hacer operaciones sobre ella, Desea liquidar la entrega del dia ?", "Confirmar Liquidación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgResult == DialogResult.No)
            {
                return;
            }
            else
            {
                foreach (DataGridViewRow row in dgvDetalle.Rows)
                {
                    if (Convert.ToInt32(row.Cells[cantidadvend.Name].Value) == 0)
                    {
                        row.Cells[cantidaddev.Name].Value = String.Format("{0:#,##0.00}", Convert.ToDouble(row.Cells[cantidad.Name].Value));
                    }
                }
                RecorreDetalle();
                foreach (clsDetallePedido det1 in detalle)
                {
                    AdmPedido.updatedetallesalidaconsultext(det1);
                }

                foreach (Int32 x in listNotas)
                {
                    fv = AdmVenta.CargaFacturaVenta(x);
                    fv.Codsalidaconsulext = Int32.Parse(CodPedido);
                    AdmVenta.updatensconsultext(fv);
                }
                if (AdmPedido.liquidar(Convert.ToInt32(CodPedido)))
                {
                    MessageBox.Show("La entrega ha sido liquidada", "Liquidación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Exemplo n.º 8
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvVentas.Rows.Count >= 1 && dgvVentas.CurrentRow != null)
                {
                    DataGridViewRow row = dgvVentas.CurrentRow;
                    if (btnAnular.Text == "Anular")
                    {
                        if (dgvVentas.Rows.Count >= 1 && dgvVentas.CurrentRow.Index != -1)
                        {
                            DialogResult dlgResult = MessageBox.Show("Esta seguro que desea anular el documento seleccionado", "Notas", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (dlgResult == DialogResult.No)
                            {
                                return;
                            }
                            else
                            {
                                venta        = AdmVenta.CargaFacturaVenta(Convert.ToInt32(venta.CodFacturaVenta));
                                dt_AnulaPago = admPago.MuestraPagoVentaAnula(frmLogin.iCodAlmacen, Convert.ToInt32(venta.CodFacturaVenta));

                                if (venta.Anulado == 1)
                                {
                                    MessageBox.Show("El documento ya se a anulado anteriormente..!", "Ventas",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return;
                                }

                                nota2 = AdmVenta.BuscaNotaSalida(Convert.ToInt32(venta.CodFacturaVenta), frmLogin.iCodAlmacen);
                                Boolean verifica = false;
                                Int32   CodNotaSalida;
                                if (AdmVenta.anular(Convert.ToInt32(venta.CodFacturaVenta)))
                                {
                                    if (nota2 != null)
                                    {
                                        CodNotaSalida            = Convert.ToInt32(nota2.CodNotaIngreso);
                                        trans                    = admTrans.MuestraTransaccion(8); //8 Ingreso por Devolucion
                                        nota2.CodTipoTransaccion = trans.CodTransaccion;
                                        doc = Admdoc.BuscaTipoDocumento("DIA");                    // DOCUMENTO INTERNO ANULACION
                                        ser = Admser.BuscaSeriexDocumento(doc.CodTipoDocumento, frmLogin.iCodAlmacen);

                                        nota2.Serie  = ser.Serie;
                                        nota2.NumDoc = Convert.ToString(ser.Numeracion);
                                        nota2.DescripcionTransaccion = trans.Descripcion;
                                        nota2.CodTipoDocumento       = doc.CodTipoDocumento;
                                        nota2.CodSerie      = ser.CodSerie;
                                        nota2.CodReferencia = nota2.DocumentoReferencia;
                                        if (!AdmIngreso.insert(nota2))
                                        {
                                            MessageBox.Show("No se pudo registrar el ingreso..!", "Ventas",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("Error al consultar Venta", "Ventas",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        return;
                                    }

                                    dt_AnulaVenta = AdmVenta.CargaDetalleNotaSalida(Convert.ToInt32(CodNotaSalida), frmLogin.iCodAlmacen);
                                    LeeProductos();

                                    foreach (clsDetalleNotaIngreso det in lstNotaIng)
                                    {
                                        if (!AdmIngreso.insertdetalle(det))
                                        {
                                            MessageBox.Show("No se puede devolver productos..!", "Ventas",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            verifica = false;
                                        }

                                        /*if (venta.Anulado != 1)
                                         * {
                                         *  if (!AdmVenta.UpdateKardex(Convert.ToInt32(nota2.CodNotaIngreso), Convert.ToInt32(det.CodProducto), frmLogin.iCodAlmacen, Convert.ToDecimal(det.Cantidad),Convert.ToDecimal(det.Importe)))
                                         *  {
                                         *
                                         *
                                         *  }
                                         * }*/
                                    }

                                    foreach (DataRow row2 in dt_AnulaPago.Rows)
                                    {
                                        if (!admPago.AnularPago(Convert.ToInt32(row2[0])))
                                        {
                                            MessageBox.Show("No se ha podido eliminar el pago", "Pagos",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            verifica = false;
                                        }
                                    }


                                    verifica = true;
                                    if (verifica == true)
                                    {
                                        MessageBox.Show("El documento ha sido anulado correctamente", "Ventas",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    }
                                    else
                                    {
                                        MessageBox.Show("El documento no se ha  anulado correctamente", "Ventas",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    }
                                    CargaLista();
                                }
                            }
                        }
                    }
                    else if (btnAnular.Text == "Activar")
                    {
                        if (dgvVentas.Rows.Count >= 1 && dgvVentas.CurrentRow.Index != -1)
                        {
                            DialogResult dlgResult = MessageBox.Show("Esta seguro que desea activar el documento seleccionado", "Notas", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (dlgResult == DialogResult.No)
                            {
                                return;
                            }
                            else
                            {
                                if (AdmVenta.activar(Convert.ToInt32(venta.CodFacturaVenta)))
                                {
                                    MessageBox.Show("El documento ha sido activado correctamente", "Notas", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    CargaLista();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception a) { MessageBox.Show(a.Message); }
        }