Esempio n. 1
0
        private void frmCambiarCaja_Load(object sender, EventArgs e)
        {
            CajasImplement oCajasImplement = new CajasImplement();
            cobranzas oCobranza = new cobranzas();
            CobranzasImplement oCobranzasImplement = new CobranzasImplement();
            oCobranza = oCobranzasImplement.GetByIdFactura(_idFactura);
            _caja = oCobranza.id_caja.ToString();

            txtCajaActual.Text = _caja;
            txtCajaActualDescripcion.Text = oCajasImplement.Get(int.Parse(_caja)).caja;
            CargarCajasActivas();
        }
Esempio n. 2
0
 private void btnCambiar_Click(object sender, EventArgs e)
 {
     FacturasImplement oFacturasImplement = new FacturasImplement();
     cobranzas oCobranza = new cobranzas();
     CobranzasImplement oCobranzasImplement = new CobranzasImplement();
     if (oFacturasImplement.ExisteCobranza(_idFactura))
     {
         oCobranza = oCobranzasImplement.GetByIdFactura(_idFactura);
         if (oCobranza != null)
         {
             oCobranza.id_caja = int.Parse(cmbCajaNueva.SelectedValue.ToString());
             oCobranzasImplement.Update(oCobranza);
             this.Close();
         }
     }
 }
Esempio n. 3
0
        private void CargarDatos()
        {
            if (txtNroFactura.Text.Length > 0) {

                facturas oFacturas = new facturas();
                socios oSocio = new socios();
                SocioImplement oSocioImplement = new SocioImplement();
                FacturasImplement oFacturasImplement = new FacturasImplement();
                PeriodosImplement oPeriodosImplement = new PeriodosImplement();
                FacturasDetallesImplement oFacturasDetallesImplement = new FacturasDetallesImplement();
                _idFactura = int.Parse(txtNroFactura.Text);
                if (oFacturasImplement.ExisteFactura(_idFactura))
                {
                    oFacturas = oFacturasImplement.Get(int.Parse(txtNroFactura.Text));
                    oSocio = oSocioImplement.Get((int)oFacturas.id_socio);
                    _idSocio = oSocio.id_socio;
                    txtCodigoSubCodSocio.Text = oSocio.codigo_socio + "/" + oSocio.subcodigo_socio;
                    txtNombreSocio.Text = oSocio.nombre;
                    txtVencimiento.Text = ((DateTime)oPeriodosImplement.Get(oFacturas.id_periodo).fecha_primer_venc).ToShortDateString();
                    //facturado = neto + iva
                    DataTable detallesFacturaDT = oFacturasImplement.GetByIdFacturaDT(oFacturas.id_factura);
                    decimal _totalFacturado = 0;
                    decimal _importeTotal = 0;
                    decimal _convenio = 0;
                    decimal _acciones = 0;
                    foreach (DataRow dr in detallesFacturaDT.Rows)
                    {
                        //IVA = decimal.Parse(dr["IVA"].ToString());
                        _totalFacturado = _totalFacturado + decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString());
                        _importeTotal = _importeTotal + decimal.Parse(dr["Total"].ToString());
                        _convenio = _convenio + decimal.Parse(dr["Convenio"].ToString());
                        _acciones = _acciones + decimal.Parse(dr["Acciones"].ToString());
                    }

                    txtFacturado.Text = _totalFacturado.ToString();
                    txtCobrado.Text = oFacturas.cobrado.ToString();
                    txtResto.Text = (_totalFacturado - (decimal.Parse(oFacturas.cobrado.ToString()))).ToString();
                    txtDescuento.Text = "0";
                    CalculosFactura oCalculosFacturas = new CalculosFactura();
                    txtRecargo.Text = (oCalculosFacturas.CalcularRecargo(oFacturas.id_factura) + oCalculosFacturas.CalcularIVARecargo(oFacturas.id_factura)).ToString();
                    txtTotal.Text = (_importeTotal - (decimal)oFacturas.cobrado - decimal.Parse(txtDescuento.Text)).ToString();
                    txtConvenio.Text = _convenio.ToString();
                    txtAcciones.Text = _acciones.ToString();

                    CobranzasImplement oCobranzasImplement = new CobranzasImplement();

                    txtFactIngresadas.Text = oCobranzasImplement.GetFacturas(dtpFechaCaja.Value).ToString();

                    txtTotalCobrado.Text = _importeTotal.ToString();
                    txtTotalFactura.Text = _importeTotal.ToString(); ;
                    txtDiferencia.Text = (decimal.Parse(txtTotalFactura.Text) - decimal.Parse(txtTotalCobrado.Text)).ToString();
                }
                else {
                    //si esta con cobranza entonces seria para cambiar la caja
                    if (oFacturasImplement.ExisteCobranza(_idFactura))
                    {
                        _existeCobranza = true;
                    }
                    else
                    {
                        _existeCobranza = false;
                    }
                }
            }
        }
Esempio n. 4
0
        private void GuardarCobranza()
        {
            facturas oFacturas = new facturas();
            socios oSocio = new socios();
            SocioImplement oSocioImplement = new SocioImplement();
            FacturasImplement oFacturasImplement = new FacturasImplement();
            PeriodosImplement oPeriodosImplement = new PeriodosImplement();
            FacturasDetallesImplement oFacturasDetallesImplement = new FacturasDetallesImplement();

            oFacturas = oFacturasImplement.Get(int.Parse(txtNroFactura.Text));
            oFacturas.id_estadoPago = 3;
            oFacturasImplement.Update(oFacturas);

            cobranzas oCobranza = new cobranzas();
            oCobranza.id_caja = int.Parse(cmbCaja.SelectedValue.ToString());
            oCobranza.id_factura = _idFactura;
            oCobranza.id_recibo = 0;
            oCobranza.id_socio = _idSocio;
            oCobranza.importe = decimal.Parse(txtTotalCobrado.Text);
            oCobranza.descuento_convenio = 0;
            oCobranza.iva_descuento_convenio = 0;
            oCobranza.fecha_cobro = dtpFechaCaja.Value;
            oCobranza.id_terminal = 0;//VER
            oCobranza.fecha_registro = DateTime.Now;
            CobranzasImplement oCobranzasImplement = new CobranzasImplement();
            oCobranzasImplement.Save(oCobranza);
        }