Example #1
0
        private void Btn_Aceptar_Click(object sender, EventArgs e)
        {
            Datos.Caja C = new Datos.Caja();
            C.Id_Caja_Tipo = (Ingreso_radioButton.Checked) ? 2 : 3;
            C.Fecha_Caja   = fecha_CajaDateTimePicker.Value;
            C.Importe_Caja = importe_CajaNumericUpDown.Value;
            C.Tag_Caja     = tag_CajaTextBox.Text;
            try
            {
                if (importe_CajaNumericUpDown.Value == 0)
                {
                    if (MessageBox.Show("Esta agregando un movimiento en la caja con un importe de 0(Cero) pesos, ¿Desea continuar?", "Sin importe!", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                }

                Datos.Caja.Add(C);
                MessageBox.Show("Se ha agregado un nuevo registro.");
                Close();
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }
Example #2
0
        private void FrmContarCaja_Load(object sender, EventArgs e)
        {
            Datos.Caja C = Datos.Caja.GetCajaRelacional("");

            decimal Saldo = 0;

            foreach (Datos.Caja ItemCaja in C.ListaCaja)
            {
                switch (ItemCaja.Id_Caja_Tipo)
                {
                case 1:
                    Saldo += ItemCaja.Importe_Caja;
                    break;

                case 2:
                    Saldo += ItemCaja.Importe_Caja;
                    break;

                case 3:;
                    Saldo -= ItemCaja.Importe_Caja;
                    break;
                }
            }
            TotalInicial.Value = Saldo;
        }
Example #3
0
        public FrmOrdenPagoABM(string IdRecivoOrdenPago)
        {
            InitializeComponent();
            try
            {
                //Desabilito el boton para que no se pueda modificar
                Btn_Aceptar.Enabled = false;

                Datos.Factura F = Datos.Factura.GetFacturaRelacional(IdRecivoOrdenPago, "", "", "", "", "");


                id_TerceroTextBox.Text = F.ListaFactura[0].Id_Tercero.ToString();
                Txt_NombreTercero.Text = F.ListaFactura[0].Tercero.Razon_Social_Tercero;

                puesto_FacturaTextBox.Text             = F.ListaFactura[0].Puesto_Factura.ToString("0000");
                numero_Comprobante_FacturaTextBox.Text = F.ListaFactura[0].Numero_Factura.ToString("00000000");

                Txt_Id.Text = IdRecivoOrdenPago;

                Datos.Factura_recibo_asignaciones FRA = Datos.Factura_recibo_asignaciones.GetFactura_recibo_asignaciones("", IdRecivoOrdenPago, "");

                foreach (Datos.Factura_recibo_asignaciones itemFactura_recibo_asignaciones in FRA.ListaFactura_recibo_asignaciones)
                {
                    Datos.Couta C = Datos.Couta.GetCoutaRelacional(itemFactura_recibo_asignaciones.Factura_Asignada_Factura_Recibo_Asignaciones.ToString(), "", "", "", "", "").ListaCouta[0];
                    DG_Facturas.Rows.Add();

                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Tag = MDI.FrmFactura.ValorReturn;

                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Detalle"].Value            = Datos.Factura_tipo.GetFactura_tipo(C.Factura.Id_Factura_Tipo.ToString()).ListaFactura_tipo[0].Abreviacion_Factura_Tipo;
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Remito"].Value             = C.Factura.Clase_Factura + " " + C.Factura.Puesto_Factura.ToString("0000") + "-" + C.Factura.Numero_Factura.ToString("00000000");
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Numero"].Value             = C.Numero_Couta_Couta;
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_FechaDeVencimiento"].Value = C.Fecha_Vencimineto_Couta;
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Importe1"].Value           = C.Asignacion_Cuota;
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Interes"].Value            = C.Importe_Interes_Couta;
                    DG_Facturas.Rows[DG_Facturas.Rows.Count - 1].Cells["Clm_Observaciones"].Value      = C.Observaciones_Couta;
                }

                Datos.Caja CAJA = Datos.Caja.GetCaja("", F.ListaFactura[0].Id_Factura.ToString());

                foreach (Datos.Caja itemCaja in CAJA.ListaCaja)
                {
                    DG_Efectivo.Rows.Add();
                    DG_Efectivo.Rows[DG_Efectivo.Rows.Count - 2].Cells["Clm_Importe"].Value = itemCaja.Importe_Caja;
                }

                CHECARTE.ListaCheque_cartera = new List <Datos.Cheque_cartera>();
                Datos.Cheque_cartera CC = Datos.Cheque_cartera.GetCheque_carteraRelacional("", F.ListaFactura[0].Id_Factura.ToString());
                foreach (Datos.Cheque_cartera itemCheque_cartera in CC.ListaCheque_cartera)
                {
                    CHECARTE.ListaCheque_cartera.Add(itemCheque_cartera);
                }

                CalcularAsignacionesFacturas();
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }
Example #4
0
        private void Buscar()
        {
            try
            {
                //Borro todo las filas y columnas anteriores
                DG_Datos.Columns.Clear();
                DG_Datos.Rows.Clear();

                //Busco la lista de datos
                Datos.Caja C = Datos.Caja.GetCajaRelacional("");

                //Agrego las columnas de la regilla de datos.
                DG_Datos.Columns.Add("Clm_Nombre", "Observación");
                DG_Datos.Columns.Add("Clm_Fecha", "Fecha");
                DG_Datos.Columns.Add("Clm_Referencia", "Referencia");
                DG_Datos.Columns.Add("Clm_Entrada", "Entrada");
                DG_Datos.Columns.Add("Clm_Salida", "Salida");
                DG_Datos.Columns.Add("Clm_Saldo", "Saldo");

                DG_Datos.Font = new Font(Config.NombreFont, Config.TamañoFont);
                DG_Datos.Columns["Clm_Nombre"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Fecha"].AutoSizeMode      = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Referencia"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Entrada"].AutoSizeMode    = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Salida"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Saldo"].AutoSizeMode      = DataGridViewAutoSizeColumnMode.AllCells;

                //Agrego las filas
                decimal TotalEntrada      = 0;
                decimal TotalSalida       = 0;
                decimal Saldo             = 0;
                int     CantidadRegistros = 0;
                foreach (Datos.Caja ItemCaja in C.ListaCaja)
                {
                    switch (ItemCaja.Id_Caja_Tipo)
                    {
                    case 1:
                        Saldo += ItemCaja.Importe_Caja;
                        break;

                    case 2:
                        Saldo += ItemCaja.Importe_Caja;
                        break;

                    case 3:;
                        Saldo -= ItemCaja.Importe_Caja;
                        break;
                    }

                    if (DT_Desde.Value <= ItemCaja.Fecha_Caja && DT_Hasta.Value >= ItemCaja.Fecha_Caja)
                    {
                        CantidadRegistros++;
                        DG_Datos.Rows.Add();
                        DG_Datos.Rows[DG_Datos.Rows.Count - 1].Tag = ItemCaja.Id_Caja;

                        DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Nombre"].Value     = ItemCaja.Tag_Caja;
                        DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Fecha"].Value      = ItemCaja.Fecha_Caja;
                        DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Referencia"].Value = ItemCaja.Caja_tipo.Descripcion_Caja_Tipo;

                        switch (ItemCaja.Id_Caja_Tipo)
                        {
                        case 1:
                            TotalEntrada += ItemCaja.Importe_Caja;
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Entrada"].Value = ItemCaja.Importe_Caja.ToString(Config.NumeroDecimales);
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Salida"].Value  = (0).ToString(Config.NumeroDecimales);
                            break;

                        case 2:
                            TotalEntrada += ItemCaja.Importe_Caja;
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Entrada"].Value = ItemCaja.Importe_Caja.ToString(Config.NumeroDecimales);
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Salida"].Value  = (0).ToString(Config.NumeroDecimales);
                            break;

                        case 3:
                            TotalSalida += ItemCaja.Importe_Caja;
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Entrada"].Value = (0).ToString(Config.NumeroDecimales);
                            DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Salida"].Value  = ItemCaja.Importe_Caja.ToString(Config.NumeroDecimales);
                            break;
                        }
                        DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Saldo"].Value = Saldo.ToString(Config.NumeroDecimales);
                    }
                }

                Txt_CantidadRegistros.Text = CantidadRegistros.ToString();
                Txt_TotalEntrada.Text      = "$ " + TotalEntrada.ToString(Config.NumeroDecimales);
                Txt_TotalSalida.Text       = "$ " + TotalSalida.ToString(Config.NumeroDecimales);

                Txt_Total.Text = "$ " + (Saldo).ToString(Config.NumeroDecimales);

                if (NumeroFilaUltimaSeleccion != 0 && DG_Datos.Rows.Count > NumeroFilaUltimaSeleccion)
                {
                    DG_Datos.Rows[NumeroFilaUltimaSeleccion].Selected = true;
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }
Example #5
0
        private void Btn_Aceptar_Click(object sender, EventArgs e)
        {
            try
            {
                ControlValores();

                Datos.Factura F      = new Datos.Factura();
                Datos.Couta   Cuotas = new Datos.Couta();
                Cuotas.ListaCouta = new List <Datos.Couta>();

                decimal TotalInteres = 0;
                foreach (DataGridViewRow Fila in DG_Facturas.Rows)
                {
                    try
                    {
                        TotalInteres += Convert.ToDecimal(Fila.Cells["Clm_Interes"].Value);
                    }
                    catch
                    {
                        //none
                    }
                }

                Datos.Caja ObjCaja = new Datos.Caja();
                ObjCaja.ListaCaja = new List <Datos.Caja>();

                F.Id_Factura      = (Txt_Id.Text == "") ? 0 : Convert.ToInt32(Txt_Id.Text);
                F.Id_Factura_Tipo = 3;
                F.Id_Tercero      = Convert.ToInt32(id_TerceroTextBox.Text);

                F.Fecha_Factura             = DateTime.Now;
                F.Fecha_Vencimiento_Factura = DateTime.Now;
                F.Puesto_Factura            = Convert.ToInt32(puesto_FacturaTextBox.Text);
                F.Numero_Factura            = Convert.ToInt32(numero_Comprobante_FacturaTextBox.Text);
                F.Clase_Factura             = "X";
                F.Neto_Factura          = 0;
                F.IVA_105_Factura       = 0;
                F.IVA_21_Factura        = 0;
                F.IVA_27_Factura        = 0;
                F.Percepcion_Factura    = 0;
                F.Exentos_Factura       = 0;
                F.Otros_Factura         = TotalInteres;
                F.Total_Factura         = NUD_Total.Value - TotalInteres;
                F.Retencion_Factura     = 0;
                F.Anulado_Factura       = false;
                F.Observaciones_Factura = "";
                F.Interes_Factura       = 0;

                foreach (DataGridViewRow Fila in DG_Facturas.Rows)
                {
                    Datos.Couta TEMP = Datos.Couta.GetCouta(Fila.Tag.ToString(), "", "0");
                    TEMP.ListaCouta[0].Pagado_Couta          = ((TEMP.ListaCouta[0].Importe_Couta - TEMP.ListaCouta[0].Asignacion_Cuota) - Convert.ToDecimal(Fila.Cells["Clm_Importe1"].Value) <= 0) ? true : false;
                    TEMP.ListaCouta[0].Fecha_Pago_Couta      = DateTime.Now;
                    TEMP.ListaCouta[0].Importe_Interes_Couta = Convert.ToDecimal(Fila.Cells["Clm_Interes"].Value);
                    TEMP.ListaCouta[0].Asignacion_Cuota     += Convert.ToDecimal(Fila.Cells["Clm_Importe1"].Value);
                    TEMP.ListaCouta[0].Observaciones_Couta   = Fila.Cells["Clm_Observaciones"].Value.ToString();
                    Cuotas.ListaCouta.Add(TEMP.ListaCouta[0]);
                }

                foreach (DataGridViewRow Fila in DG_Efectivo.Rows)
                {
                    Datos.Caja TEMP = new Datos.Caja();
                    TEMP.Id_Caja_Tipo = 1;
                    TEMP.Fecha_Caja   = DateTime.Now;
                    TEMP.Importe_Caja = Convert.ToDecimal(Fila.Cells["Clm_Importe"].Value);
                    TEMP.Tag_Caja     = Txt_NombreTercero.Text;

                    if (TEMP.Importe_Caja != 0 || TEMP.Importe_Caja != 0)
                    {
                        ObjCaja.ListaCaja.Add(TEMP);
                    }
                }

                if (Txt_Id.Text == "")
                {
                    if (_TipoTercero == 1)
                    {
                        numero_Comprobante_FacturaTextBox.Text = Datos.Series.Bloquear("ORD").ToString("00000000");
                        Datos.Series.Desbloquear("ORD");
                    }
                    else if (_TipoTercero == 2)
                    {
                        numero_Comprobante_FacturaTextBox.Text = Datos.Series.Bloquear("RECIBOS").ToString("00000000");
                        Datos.Series.Desbloquear("RECIBOS");
                    }

                    string TipoComprobanteAnterior = "";
                    if (_TipoTercero == 1)
                    {
                        TipoComprobanteAnterior = "ORD";
                    }
                    else if (_TipoTercero == 2)
                    {
                        TipoComprobanteAnterior = "RECIBOS";
                    }

                    MDI.FrmDialogoFactura FDF = new FrmDialogoFactura(TipoComprobanteAnterior, "X", puesto_FacturaTextBox.Text, numero_Comprobante_FacturaTextBox.Text);
                    if (FDF.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        if (_TipoTercero == 1)
                        {
                            numero_Comprobante_FacturaTextBox.Text = Datos.Series.Bloquear("ORD").ToString("00000000");
                            Datos.Series.Desbloquear("ORD");
                        }
                        else if (_TipoTercero == 2)
                        {
                            numero_Comprobante_FacturaTextBox.Text = Datos.Series.Bloquear("RECIBOS").ToString("00000000");
                            Datos.Series.Desbloquear("RECIBOS");
                        }

                        if (Chk_ImprimirComprobante.Checked)
                        {
                            ImprimirDocumento.Print();
                        }

                        Datos.Factura.AddRecibo_OrdenPago(F, Cuotas, CHECARTE, ObjCaja);

                        if (_TipoTercero == 1)
                        {
                            Datos.Series.DesbloquearSumar("ORD");
                        }
                        else if (_TipoTercero == 2)
                        {
                            Datos.Series.DesbloquearSumar("RECIBOS");
                        }
                        MessageBox.Show("Se ha agregado un nuevo registro.");
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    //Datos.Factura.SetRecibo_OrdenPago(F, Facturas, ObjChequePropio, ObjDeposito, ObjTransferencia, ObjCheque_Cartera, ObjCaja, ObjTarjeta);
                    //MessageBox.Show("Se ha modificado correctamente el registro.");
                }
                CerrarVentana = true;
                Close();
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }