コード例 #1
0
 //muestra en el combobox los resultados cargados en tipo movimiento de caja
 private void llenarComboBoxTipoMovimiento()
 {
     this.cbTipoMov.DataSource = Negociocaja.mostrartipomov(6, 0, ingegr);
     //valor real de la DB
     this.cbTipoMov.ValueMember = "Codtipomov";
     //lo que se muestra
     this.cbTipoMov.DisplayMember = "Nombre";
 }
コード例 #2
0
        private void FrmCaja_Load(object sender, EventArgs e)
        {
            //fecha =  DateTime.Now;
            // panelHorizontal.BackColor = Color.FromArgb(ComponentesFormularios.ColorPanelSuperiorVioleta());
            checkradioingegr();

            llenarComboBoxTipoMovimiento();

            Negociocaja objcaja = new Negociocaja();

            objcaja.extrestadocaja(1, "", 0);

            if (objcaja.Fecha.Substring(0, 10) != dtpFechaCaja.Value.ToString("dd/MM/yyyy"))
            {
                if (objcaja.Codcuenta == 9100001)
                {
                    DialogResult dialogResult = MessageBox.Show("La caja se encuentra abierta de una fecha anterior, desea cerrarla?", "Caja abierta", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        FrmCerrarCaja objcerrar = new FrmCerrarCaja();
                        objcerrar.ShowDialog();
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        //do something else
                    }
                }
            }

            if (objcaja.Codcuenta == 9100002)
            {
                if (objcaja.Fecha.Substring(0, 10) == dtpFechaCaja.Value.ToString("dd/MM/yyyy"))
                {
                    MessageBox.Show("La caja del dia de hoy esta cerrada");
                }
                else
                {
                    DialogResult dialogResult = MessageBox.Show("La caja se encuentra cerrada, desea abrirla?", "Caja cerrada", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        FrmAperturacaja objapertura = new FrmAperturacaja();
                        objapertura.ShowDialog();
                    }
                }
                //  else if (dialogResult == DialogResult.No)
                // {
                //do something else
                // }
            }
            objcaja.extrestadocaja(1, "", 0);
            estadoabicerrada(objcaja.Codcuenta);
            refrescarcaja(Convert.ToString(DateTime.Today));
            totales();
            // voy a usar pal reporte nae objcaja.Idcierre;
            //mireporte(obj
        }
コード例 #3
0
        private void BtnCerrarCaja_Click(object sender, EventArgs e)
        {
            Negociocaja   objcaja   = new Negociocaja();
            FrmCerrarCaja objcerrar = new FrmCerrarCaja();

            objcerrar.ShowDialog();
            objcaja.extrestadocaja(1, "", 0);
            estadoabicerrada(objcaja.Codcuenta);
            refrescarcaja(Convert.ToString(DateTime.Today));
            totales();
        }
コード例 #4
0
        //muestra en el combobox los resultados cargados en tipo movimiento de caja
        private void llenarComboBoxPlancuenta()
        {
            if (cbTipoMov.ValueMember != "")
            {
                this.cbxPlanCuenta.DataSource = Negociocaja.mostrartipomov(5, Convert.ToInt32(cbTipoMov.SelectedValue), " ");
            }


            //valor real de la DB
            this.cbxPlanCuenta.ValueMember = "Codigo_Plan";
            //lo que se muestra
            this.cbxPlanCuenta.DisplayMember = "Cuenta";
        }
コード例 #5
0
        private void BtnAsentarpago_Click(object sender, EventArgs e)
        {
            string  respuesta = "";
            decimal saldo     = 0;
            int     codrecibo = 0;
            string  mensaje   = "";

            midata = new DataTable();
            Negociocaja objcaja = new Negociocaja();

            midata.Columns.Add("Idventa", typeof(int));
            midata.Columns.Add("saldo", typeof(decimal));
            midata.Columns.Add("pagado", typeof(decimal));
            midata.Columns.Add("total", typeof(decimal));
            midata.Columns.Add("estado", typeof(string));
            midata.Columns.Add("grabar", typeof(string));

            if (traerpagototal(false) != 0)
            {
                Frmasentarpago objpago = new Frmasentarpago(traerpagototal(true));
                objpago.Midatatable = midata;
                objpago.ShowDialog();
                if (objpago.Confirmarpago == true)
                {
                    cargardatatable(objpago.Importe);
                    //objpago.importe en ves de pagototal
                    respuesta = NegocioCliente.agregaromodificarrecibo(midata, objpago.Importe, idcliente, NegocioConfigEmpresa.idusuario, ref codrecibo);
                }


                if (respuesta == "ok")
                {
                    if (objcaja.chequeocaja("FrmClientes", ref mensaje) == true)
                    {
                        respuesta = Negociocaja.insertarmovcaja(1310101, Convert.ToSingle(objpago.Importe), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Recibo nro : " + codrecibo.ToString(), codrecibo, true);
                        if (respuesta == "ok")
                        {
                            NegocioCliente.modificarestadocajarecibo(codrecibo);
                        }
                    }
                    FrmReporteRecibo formrecibo = new Formreportes.FrmReporteRecibo(codrecibo);
                    formrecibo.ShowDialog();
                    UtilityFrm.mensajeConfirm("El pago se guardo con exito");
                    buscarctacte(Convert.ToInt32(txtCodigo.Text == string.Empty ? "0" : txtCodigo.Text));
                }
            }
            else
            {
                UtilityFrm.mensajeError("No hay saldo");
            }
        }
コード例 #6
0
        private void menuconfventa_Click(object sender, EventArgs e)
        {
            string mensaje  = "";
            bool   constock = false;

            try
            {
                Negociocaja objcaja = new Negociocaja();

                DataGridViewRow row = dataLista.CurrentRow;
                if (Convert.ToBoolean(row.Cells["caja"].Value) == false)
                {
                    if (objcaja.chequeocaja(this.Name, ref mensaje) == true)
                    {
                        Negociocaja.insertarmovcaja(4110107, Convert.ToSingle(row.Cells["Total"].Value.ToString()), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Venta nro : " + row.Cells["codigo"].Value.ToString(), Convert.ToInt64(row.Cells["codigo"].Value.ToString()), true);


                        if (NegocioConfigEmpresa.confsistema("stock").ToString() == this.Name)
                        {
                            DataTable ventas = cargardetallestock(row.Cells["codigo"].Value.ToString());

                            mensaje = NegocioMovStock.insertar(0, DateTime.Today,
                                                               "", row.Cells["codigo"].Value.ToString(), "VENTA", 0, "EMITIDO", "EGRESO", ventas);
                            if (mensaje != "ok")
                            {
                                constock = false;
                                UtilityFrm.mensajeError(mensaje);
                            }
                            else
                            {
                                constock = true;
                            }
                        }
                        NegocioVenta.cambiarestadoventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString()), true, constock);
                    }
                    else
                    {
                        UtilityFrm.mensajeError(mensaje);
                    }
                }
            }
            catch (Exception i)
            {
                UtilityFrm.mensajeError(i.Message);
            }
            buscarPorFecha();
            actualizarTotal();
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Negociocaja     objcaja       = new Negociocaja();
            FrmAperturacaja objformapcaja = new FrmAperturacaja();

            objcaja.extrestadocaja(1, "", 0);
            if (objcaja.Fecha.Substring(0, 10) == dtpFechaCaja.Value.ToString("dd/MM/yyyy"))
            {
                MessageBox.Show("La caja del dia de la fecha se encuentra cerrada");
            }
            else
            {
                objformapcaja.ShowDialog();
                refrescarcaja(Convert.ToString(DateTime.Today));
                objcaja.extrestadocaja(1, "", 0);
                estadoabicerrada(objcaja.Codcuenta);
            }
        }
コード例 #8
0
 private void FrmCerrarCaja_Load(object sender, EventArgs e)
 {
     try
     {
         Negociocaja objcaja = new Negociocaja();
         objcaja.extrestadocaja(1, "", 0);
         objcaja.extrestadocaja(2, objcaja.Fecha.Substring(0, 10), 0);
         lblsaldoActual.Text = Convert.ToString(objcaja.Ingreso - objcaja.Egreso);
         lblsaldoActual.Text = lblsaldoActual.Text == "Saldo" ? "0" : lblsaldoActual.Text;
         if (this.Text == "Cierre de turno")
         {
             BtnApertura.Text = "cerrar turno";
         }
     }
     catch (Exception x)
     {
         UtilityFrm.mensajeError(x.Message);
     }
 }
コード例 #9
0
        private void Menudelete_Click(object sender, EventArgs e)
        {
            Negociocaja objcaja  = new Negociocaja();
            bool        eliminar = true;

            DataGridViewRow row = dataLista.CurrentRow;

            if (9100001 == Convert.ToInt32(row.Cells["Cod_cuenta"].Value.ToString()))
            {
                MessageBox.Show("No se puede eliminar la apertura");
                eliminar = false;
            }


            else
            {
                if (9100002 == Convert.ToInt32(row.Cells["Cod_cuenta"].Value.ToString()))
                {
                    objcaja.extrestadocaja(1, "", 0);
                    if (Convert.ToInt32(row.Cells["Cod_mov"].Value.ToString()) != objcaja.Codmov)
                    {
                        MessageBox.Show("No se puede eliminar este cierre");
                        eliminar = false;
                    }
                }
                if (eliminar == true)
                {
                    DialogResult dialogResult = MessageBox.Show("Seguro que quiere eliminar el movimiento?", "Precaucion", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        string rta = Negociocaja.eliminar(Convert.ToInt32(row.Cells["Cod_mov"].Value.ToString()));
                        if (rta == "ok")
                        {
                            MessageBox.Show("Se elimino correctamente");
                        }
                    }
                }
            }
            refrescarcaja(dtpFechaCaja.Value.ToString("dd/MM/yyyy"));
            objcaja.extrestadocaja(1, "", 0);
            estadoabicerrada(objcaja.Codcuenta);
        }
コード例 #10
0
        private void buscarporfecha()

        {
            {
                try
                {
                    this.dataLista.DataSource = Negociocaja.buscarmovimiento(Convert.ToString(this.dtpFechaCaja.Text.Substring(0, 10) + "00:00:00"), Convert.ToString(this.dtpFechaCaja.Text.Substring(0, 10) + "23:59:59"));
                }

                catch (Exception ex)
                {
                    UtilityFrm.mensajeError("Error Con Base de Datos :" + ex.Message);
                }
                //datasource el origen de los datos

                //oculto las dos primeras columnas
                // this.ocultarColumnas();
                //muestro el total de las categorias
                lblTotal.Text = "Total de Registros: " + Convert.ToString(dataLista.RowCount);
            }
        }
コード例 #11
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            fecha = new DateTimePicker();
            Negociocaja objcaja  = new Negociocaja();
            string      varfecha = fecha.Text;

            long idcierre = 0;
            long idturno  = 0;


            objcaja.extraercierre("id_turno");
            idturno = objcaja.Idturno == 1 ? 1 : objcaja.Idturno + 1;
            objcaja.extraercierre("cod_cierre");
            idcierre = objcaja.Idcierre == 1 ? 1 : objcaja.Idcierre + 1;

            string msg = Negociocaja.insertarcierrecaja(idcierre, DateTime.Now.ToString(), NegocioConfigEmpresa.turno, objcaja.Ingreso, objcaja.Egreso, idturno, 0, 0, 0, NegocioConfigEmpresa.idusuario, "APERTURA");

            if (msg == "ok")
            {
                try
                {
                    Negociocaja.insertarmovcaja(9100001, Convert.ToSingle(txtImporte.Text),
                                                0, fecha.Value.ToString("dd/MM/yyyy"), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno,
                                                "APERTURA DE CAJA", 0, true);
                }
                catch (Exception s)
                {
                    UtilityFrm.mensajeError(s.Message);
                }
            }
            else
            {
                UtilityFrm.mensajeError(msg);
            }



            this.Close();
        }
コード例 #12
0
        public void refrescarcaja(string fecha)
        {
            // DateTimePicker fecha = new DateTimePicker();
            DataTable midatatable = Negociocaja.buscarmovimiento(fecha.Substring(0, 10) + " 00:00:00", fecha.Substring(0, 10) + " 23:59:59");

            dataLista.DataSource = midatatable;


            DataView dv = new DataView(midatatable);

            dv.RowFilter = "cod_cuenta = 9100001";
            foreach (DataRow lista in midatatable.Rows)
            {
                idcierre = Convert.ToInt64(lista["idcierre"].ToString());
            }


            dataLista.AutoResizeColumns();
            dataLista.AutoSizeColumnsMode    = DataGridViewAutoSizeColumnsMode.AllCells;
            dataLista.Columns["Fecha"].Width = 400;
            dataLista.Columns["Ingreso"].DefaultCellStyle.Format = "###,##0.00";
            dataLista.Columns["Egreso"].DefaultCellStyle.Format  = "###,##0.00";
            //Cod_mov,Cod_cuenta,Concepto,Fecha ,Comprobante,Ingreso,Egreso,Turno
        }
コード例 #13
0
        private void BtnApertura_Click(object sender, EventArgs e)
        {
            string      msg     = "";
            Negociocaja objcaja = new Negociocaja();

            objcaja.extrestadocaja(1, "", 0);
            float importe = 0;

            if (TxtConcepto.Text == "" || TxtConcepto.Text == "0")
            {
                MessageBox.Show("ingrese un importe para continuar");
            }
            else
            {
                importe = Convert.ToSingle(TxtConcepto.Text) - Convert.ToSingle(lblsaldoActual.Text);

                if (importe < 0)
                {
                    msg = Negociocaja.insertarmovcaja(9100003, 0, (importe * -1), objcaja.Fecha, NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "FALTANTE DE CAJA", 0, true);
                }

                else if (importe > 0)
                {
                    Negociocaja.insertarmovcaja(9100004, importe, 0, objcaja.Fecha, NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "SOBRANTE DE CAJA", 0, true);
                }

                msg = Negociocaja.insertarmovcaja(9100002, 0, 0, objcaja.Fecha, NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "CIERRE DE CAJA", 0, true);

                if (msg == "ok")
                {
                    idcierre = 0;
                    idturno  = 0;
                    objcaja.extraercierre("id_turno");
                    idturno = objcaja.Idturno;
                    objcaja.extraercierre("cod_cierre");
                    idcierre = objcaja.Idcierre;
                    // objcaja.extrestadocaja(3, "", idturno);


                    objcaja.extrestadocaja(2, objcaja.Fecha.Substring(0, 10), 0, true);
                    if (this.Text == "Cierre de turno")
                    {
                        Negociocaja.insertarcierrecaja(idcierre, objcaja.Fecha, NegocioConfigEmpresa.turno, objcaja.Ingreso, objcaja.Egreso, 1, Convert.ToDecimal(lblsaldoActual.Text), Convert.ToDecimal(TxtConcepto.Text), 1, NegocioConfigEmpresa.idusuario, "CIERRE");
                    }

                    if (this.Text == "Cierre de caja")
                    {
                        Negociocaja.insertarcierrecaja(idcierre, DateTime.Now.ToString(), NegocioConfigEmpresa.turno, objcaja.Ingreso, objcaja.Egreso, idturno, Convert.ToDecimal(lblsaldoActual.Text), Convert.ToDecimal(TxtConcepto.Text), 1, NegocioConfigEmpresa.idusuario, "CIERRE");
                    }

                    if (msg != "ok")
                    {
                        UtilityFrm.mensajeError("Ha ocurrido un error: " + msg);
                    }
                }
                else
                {
                    UtilityFrm.mensajeError("Ha ocurrido un error: " + msg);
                }
                //Negociocaja.insertarmovcaja (
            }
            this.Close();
        }
コード例 #14
0
        public void guardarventa()
        {
            int     nroterminal    = 0;
            int     codtarjeta     = 0;
            string  cupon          = "";
            string  lote           = "";
            decimal importe        = 0;
            int     cuota          = 0;
            int     codformapago   = 1;
            string  msg            = "ok";
            string  precioneto     = "";
            string  cantidad       = "";
            decimal var            = 0;
            Char    estadofactura  = 'P'; //P : pendiente de factura F : facturado
            string  nrocomprobante = "";

            totales();
            NegocioVenta objventa = new NegocioVenta();
            DataTable    dt       = new DataTable();

            dt.Columns.Add("Codigo", typeof(string));
            dt.Columns.Add("Precio", typeof(decimal));
            dt.Columns.Add("Cantidad", typeof(string));
            dt.Columns.Add("Descuento", typeof(decimal));
            dt.Columns.Add("Importe", typeof(decimal));
            dt.Columns.Add("Producto", typeof(string));
            dt.Columns.Add("Precioneto", typeof(string));
            dt.Columns.Add("Pesable", typeof(int));

            DataTable DTOrdenpedido = new DataTable();

            DTOrdenpedido.Columns.Add("Codigo", typeof(string));
            DTOrdenpedido.Columns.Add("cantidadparcial", typeof(string));
            DTOrdenpedido.Columns.Add("cantidadtotal", typeof(string));
            DTOrdenpedido.Columns.Add("detalle", typeof(string));

            decimal IVA = 21;

            if (formapago == "tarjeta")
            {
                codtarjeta   = this.codtarjeta;
                cupon        = txtCupon.Text == "" ? "0":txtCupon.Text;
                lote         = txtLote.Text == "" ? "0" : txtLote.Text;
                cuota        = Convert.ToInt32(lblCuota.Text);
                importe      = Convert.ToDecimal(lblImportecuota.Text);
                codformapago = 2;
            }
            if (formapago == "ctacte")
            {
                codformapago = 3;
            }


            /*IMPORTANTE HACER NOTA DE VENTA PARA IMPRIMIR*/
            //if (MessageBox.Show("Desea Imprimir Venta?", "Imprimir"
            //   , MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.Yes)
            //{
            //    FrmImpVenta venta = new FrmImpVenta(totalAPagar);
            //    venta.Show();
            //}
            //else {
            //    this.Close();
            //}

            try
            {
                //LISTA DE PRODUCTOS SE LE ASIGNA EN EL MOMENTO QUE SE MUESTRA EL FORMULARIO

                // NumberFormatInfo asociado con la cultura en-US.
                NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;



                foreach (DataGridViewRow fila in listadoDeProducto.Rows)
                {
                    if (responsableiva != "EX")
                    {
                        var = Decimal.Round(Convert.ToDecimal(fila.Cells["CPrecio"].Value) / Convert.ToDecimal(1.21), 2);
                    }
                    else
                    {
                        var = Decimal.Round(Convert.ToDecimal(fila.Cells["CPrecio"].Value), 2);
                    }

                    //Math.Round(decValue, 2, MidpointRounding.AwayFromZero)
                    // var = Math.Round(var, 2, MidpointRounding.AwayFromZero);

                    precioneto = var.ToString("0.0000", nfi);
                    //var = Convert.ToDecimal(fila.Cells["Cantidad"].Value);
                    //cantidad = var.ToString("0.00", nfi);
                    //recorro la lista pasado por paramentro y asigno al datatable para generar la transaccion
                    //dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["Precio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value);
                    dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["CPrecio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value, fila.Cells["Producto"].Value, precioneto, fila.Cells["Dpesable"].Value);

                    DTOrdenpedido.Rows.Add(fila.Cells["Codigo"].Value, "0", fila.Cells["Cantidad"].Value, fila.Cells["Producto"].Value);
                }



                try
                {
                    if (NegocioConfigEmpresa.confsistema("facturar").ToString() == "True" && tipo_comprobante == "NOTA DE VENTA" && tipofactura != "X")
                    {
                        if (NegocioConfigEmpresa.marcafiscal != "")
                        {
                            msg = objcomprobante.factura(NegocioConfigEmpresa.marcafiscal, dt, Convert.ToDouble(txtTotalAPagar.Text), NegocioConfigEmpresa.modelofiscal, NegocioConfigEmpresa.puertofiscal,
                                                         1, razonsocial, razonsocial == "CONSUMIDOR FINAL" ? "99999999999" : cuit, domicilio, tipofactura, responsableiva, tipofactura, tipofactura, Convert.ToDouble(neto), Convert.ToDouble(iva), Convert.ToDouble(this.neto105), Convert.ToDouble(this.iva105));
                        }
                        else
                        {
                            UtilityFrm.mensajeError("La marca de la fiscal no se encuentra definido, la factura quedara pendiente");
                        }
                        if (msg.Substring(0, 2) != "ok")
                        {
                            UtilityFrm.mensajeError(msg);
                            UtilityFrm.mensajeConfirm("Se guardara la venta como pendiente de factura la puede encontrar en lista de ventas");
                            estadofactura = 'P';
                        }
                        else
                        {
                            estadofactura = 'F';
                            //corregir para que no genere errores
                            int nrocaracteres = Convert.ToInt32(msg.Length.ToString());
                            nrocomprobante = msg.Substring(2, nrocaracteres - 2);
                        }
                    }
                    else
                    {
                        estadofactura = 'P';
                    }
                }
                catch (Exception e)
                {
                    UtilityFrm.mensajeError(e.Message);
                }
                string Rta = objventa.Insertar(this.idCliente, DateTime.Now, Tipo_comprobante,
                                               objcomprobante.Puntoventa.PadLeft(5, '0'), msg.Substring(0, 2) == "ok" ? nrocomprobante.PadLeft(8, '0') : "0",
                                               IVA, this.concaja, this.constock, NegocioConfigEmpresa.usuarioconectado, dt,
                                               Convert.ToDecimal(txtBonificacion.Text == "" ? txtBonificacion.Text = "0" : txtBonificacion.Text),
                                               Convert.ToDecimal(txtTotalAPagar.Text), Convert.ToDecimal(lblsubtotal.Text), estadofactura,
                                               NegocioConfigEmpresa.confsistema("stock").ToString() == this.Name && pendientedestock == false ? true : false, nroterminal,
                                               codtarjeta, cupon, lote, importe, cuota, codformapago, neto, iva, objcomprobante.Cae, objcomprobante.Fechavto,
                                               objcomprobante.Numerotipofactura.PadLeft(3, '0'), objcomprobante.Puntoventa.PadLeft(5, '0'), this.iva105, this.neto105);

                int objnum = objventa.Idventa;

                if (Rta == "OK" || Rta == "ok")
                {
                    if (pendientedestock == true)
                    {
                        NegocioRetirodeMercaderia.insertar(DateTime.Now, this.idCliente, NegocioConfigEmpresa.idusuario, "VENTA", "PENDIENTE", "", DTOrdenpedido, this.idCliente, 1, objnum);
                    }

                    if (this.concaja == true)
                    {
                        Rta = Negociocaja.insertarmovcaja(4110107, Convert.ToSingle(txtTotalAPagar.Text), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Venta nro : " + objventa.Idventa.ToString(), objventa.Idventa, true);
                    }
                    else
                    {
                        Rta = "ok";
                    }

                    if (Rta == "ok")
                    {
                        trans = Rta;

                        Reporteventa mireporteventa = new Reporteventa();
                        // Frmimpnotaventa miformnotaventa = new Frmimpnotaventa();
                        // Frmimpventicket miformticket = new Frmimpventicket();

                        if (NegocioConfigEmpresa.confsistema("imprimirventa").ToString() == "True")
                        {
                            if (NegocioConfigEmpresa.confsistema("tipoimpresion").ToString() == "tipocarro")
                            {
                                //con crystal report
                                //  miformnotaventa.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa"));
                                //   miformnotaventa.Codventa = objventa.Idventa;
                                //   miformnotaventa.Show();
                                // con reportviewer
                                mireporteventa.Idventa = objventa.Idventa;
                                mireporteventa.ShowDialog();
                            }

                            else
                            {
                                if (NegocioConfigEmpresa.marcafiscal == "elec" && tipofactura != "X")
                                {
                                    Ticketventa miticket = new Formreportes.Ticketventa(objventa.Idventa);
                                    miticket.ShowDialog();
                                }
                                else if (tipofactura == "X")
                                {
                                    TicketProforma miticketproforma = new Formreportes.TicketProforma(objventa.Idventa);
                                    miticketproforma.ShowDialog();
                                }
                                //miformticket.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa"));
                                //miformticket.Codventa = objventa.Idventa;
                                //miformticket.Show();
                            }
                        }



                        if (facturar == true)
                        {
                            //  NegocioFHasar objhasar = new NegocioFHasar();
                            //objhasar.Comprobantefiscal(1, 1, "CONSUMIDOR FINAL", "9999999", 1, "", dt,Convert.ToDouble (lblPrecioTotal.Text ));
                        }
                        //  crystalReportViewer1.ReportSource = ventasTicket1;

                        this.Close();
                    }
                    else
                    {
                        UtilityFrm.mensajeError("Error en la base de Datos 1");
                    }
                }
                else
                {
                    UtilityFrm.mensajeError("Error en la base de Datos 2");
                }
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError(ex.Message);
            }
        }
コード例 #15
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            try

            {
                Negociocaja objcaja = new Negociocaja();
                bool        concaja = true;
                bool        control = true;
                string      msg     = "";

                objcaja.extrestadocaja(1, "", 0);
                objcaja.extrestadocaja(2, objcaja.Fecha.Substring(0, 10), 0);
                //codigo de cuenta para cierre de caja
                //si está cerrado no permite generar la venta hasta no abrir la caja
                if (objcaja.Fecha.Substring(0, 10) != Convert.ToString(DateTime.Today).Substring(0, 10))
                {
                    if (objcaja.Codcuenta == 9100001)
                    {
                        concaja = false;
                        msg     = "La caja se encuentra abierta de una fecha anterior, no se puede continuar";
                    }
                }

                if (objcaja.Codcuenta == 9100002)
                {
                    concaja = false;
                    msg     = "La caja esta cerrada, para vender realizar la apertura correspondiente";
                }

                if (concaja == true)
                {
                    if (rbEgreso.Checked == true)
                    {
                        if (objcaja.Ingreso < Convert.ToDouble(textBox2.Text))
                        {
                            control = false;
                            msg     = "No tiene fondo para realizar el movimiento";
                        }
                    }

                    if ((TxtConcepto.Text == "") || (textBox2.Text == ""))
                    {
                        control = false;
                        msg     = "Controle de no dejar valores en blanco y vuelva a intentar";
                    }

                    if (control == true)
                    {
                        string rpta = Negociocaja.insertarmovcaja(Convert.ToInt32(cbxPlanCuenta.SelectedValue), (rbIngreso.Checked == true) ? Convert.ToSingle(textBox2.Text) : 0,
                                                                  (rbEgreso.Checked == true) ? Convert.ToSingle(textBox2.Text) : 0, Convert.ToString(DateTime.Today), NegocioConfigEmpresa.usuarioconectado, 1, NegocioConfigEmpresa.turno,
                                                                  TxtConcepto.Text, 0, true);
                        refrescarcaja(Convert.ToString(DateTime.Today));
                        totales();
                        checkradioingegr();
                        TxtConcepto.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        UtilityFrm.mensajeError(msg);
                    }
                }
                else
                {
                    UtilityFrm.mensajeError(msg);
                }
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("Ha ocurrido un error:" + ex.Message);
            }
        }