Пример #1
0
 private void dtpFechaCaja_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FacturasImplement oFacturasImplement = new FacturasImplement();
         if (oFacturasImplement.ExisteFactura(_idFactura))
         {
             if (dtpFechaCobro.Visible && dtpFechaCobro.Enabled)
             {
                 dtpFechaCobro.Focus();
             }
             else
             {
                 DialogResult result = MessageBox.Show("Se completará el proceso de cobranza", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                 if (result.Equals(DialogResult.OK))
                 {
                     GuardarCobranza();
                     LimpiarCampos();
                 }
                 else
                 {
                     //nada
                 }
             }
         }
     }
 }
Пример #2
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;
                    }
                }
            }
        }