Exemple #1
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                rpta = NCaja.Insertar(Convert.ToInt32(frmPrincipal.f1.lblIdUsuario.Text), "1", "INGRESO", Convert.ToDecimal(this.lblTotal.Text), "Ingreso Delivery", "EFECTIVO");
                if (rpta == "OK")
                {
                    rpta = NCaja.Insertar(Convert.ToInt32(frmPrincipal.f1.lblIdUsuario.Text), "1", "INGRESO", Convert.ToDecimal(this.lblVuelto.Text), "Ingreso Vuelto", "EFECTIVO");
                    if (rpta == "OK")
                    {
                        rpta = NDelivery.Editar(Convert.ToInt32(this.lblIdVenta.Text), "PAGADA");
                        if (rpta == "OK")
                        {
                            MessageBox.Show("Se registró correctamente");

                            this.Hide();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se completó la operación");
            }
        }
Exemple #2
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            try
            {
                string  rpta   = "";
                decimal vuelto = Convert.ToDecimal(this.lblVuelto.Text);
                if (vuelto > 0)
                {
                    rpta = NCaja.Insertar(Convert.ToInt32(frmPrincipal.f1.lblIdUsuario.Text), "1", "EGRESO", vuelto, "Vuelto Delivery", "EFECTIVO");
                    if (rpta == "OK")
                    {
                        decimal total    = Convert.ToDecimal(this.lblTotal.Text);
                        decimal subTotal = Decimal.Round(total / 1.18m, 2);
                        decimal igv      = total - subTotal;
                        rpta = NComprobante.Insertar(this.lblTipoComprobante.Text, 1, igv, DateTime.Now, Convert.ToInt32(this.lblIdVenta.Text), "EMITIDA", Convert.ToInt32(this.lblIdCliente.Text),
                                                     total, total, 00.00m, 00.00m, "EFECTIVO", vuelto);
                        if (rpta == "OK")
                        {
                            rpta = NDelivery.Editar(Convert.ToInt32(this.lblIdVenta.Text), "Enviado");
                            if (rpta == "OK")
                            {
                                this.dataDetalle.DataSource = NVenta.mostrarDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));
                                this.dtDetalleVenta         = NVenta.mostrarDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));
                                NImprimir_Comprobante.imprimirCom(Convert.ToInt32(this.lblIdVenta.Text), this.lblTipoComprobante.Text, this.lblCliente.Text, this.lblDireccion.Text,
                                                                  this.lblNroDoc.Text, this.lblRepartidos.Text, "D", "DELIVERY", dataDetalle, this.lblDctoInd.Text, "00.00", subTotal.ToString(), igv.ToString(), total.ToString(),
                                                                  total.ToString(), this.lblVuelto.Text, "00.00", "EFECTIVO", "Detallado", "00.00", this.lblTelefono.Text, NAliento.MensajeAliento());
                                this.Facturador(Convert.ToInt32(this.lblIdVenta.Text), dtDetalleVenta);
                                MessageBox.Show("Se registró correctamente");

                                this.Hide();
                            }
                        }
                    }
                }
                else
                {
                    decimal total    = Convert.ToDecimal(this.lblTotal.Text);
                    decimal subTotal = Decimal.Round(total / 1.18m, 2);
                    decimal igv      = total - subTotal;
                    rpta = NComprobante.Insertar(this.lblTipoComprobante.Text, 1, igv, DateTime.Now, Convert.ToInt32(this.lblIdVenta.Text), "EMITIDA", Convert.ToInt32(this.lblIdCliente.Text),
                                                 total, total, 00.00m, 00.00m, "EFECTIVO", vuelto);
                    if (rpta == "OK")
                    {
                        rpta = NDelivery.Editar(Convert.ToInt32(this.lblIdVenta.Text), "Enviado");
                        if (rpta == "OK")
                        {
                            this.dataDetalle.DataSource = NVenta.mostrarDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));
                            this.dtDetalleVenta         = NVenta.mostrarDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));
                            NImprimir_Comprobante.imprimirCom(Convert.ToInt32(this.lblIdVenta.Text), this.lblTipoComprobante.Text, this.lblCliente.Text, this.lblDireccion.Text,
                                                              this.lblNroDoc.Text, this.lblRepartidos.Text, "D", "DELIVERY", dataDetalle, this.lblDctoInd.Text, "00.00", subTotal.ToString(), igv.ToString(), total.ToString(),
                                                              total.ToString(), this.lblVuelto.Text, "00.00", "EFECTIVO", "Detallado", "00.00", this.lblTelefono.Text, NAliento.MensajeAliento());
                            this.Facturador(Convert.ToInt32(this.lblIdVenta.Text), dtDetalleVenta);
                            MessageBox.Show("Se registró correctamente");

                            this.Hide();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se completó la operación");
            }
        }