Ejemplo n.º 1
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(cConexion.Cadenacon());

            con.Open();
            SqlTransaction tranOrden;
            Int32          CodCheque = Convert.ToInt32(frmPrincipal.CodigoPrincipal);

            tranOrden = con.BeginTransaction("TranOrden");
            try
            {
                cCheque objCheque = new cCheque();
                objCheque.AnularPagoCheque(con, tranOrden, CodCheque);
                cCobroCheque objCobroCheque = new cCobroCheque();
                objCobroCheque.BorrarCobroCheque(con, tranOrden, CodCheque);
                tranOrden.Commit();
                con.Close();
                Mensaje("Datos grabados correctamente");
            }
            catch (Exception ex)
            {
                tranOrden.Rollback();
                con.Close();
                Mensaje("Hubo un error en el proceso de grabación");
            }
            Buscar(CodCheque);
        }
Ejemplo n.º 2
0
        private void btnBuscarOrden_Click(object sender, EventArgs e)
        {
            if (fun.ValidarFecha(txtFechaDesde.Text) == false)
            {
                Mensaje("La fecha desde es incorrecta");
                return;
            }

            if (fun.ValidarFecha(txtFechaHasta.Text) == false)
            {
                Mensaje("La fecha hasta es incorrecta");
                return;
            }

            DateTime  fechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime  fechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            cCheque   Cheque     = new cCheque();
            DataTable trdo       = Cheque.GetChequesxFecha(fechaDesde, fechaHasta);

            trdo = fun.TablaaMiles(trdo, "Importe");
            trdo = fun.TablaaMiles(trdo, "Saldo");
            Grilla.DataSource            = trdo;
            Grilla.Columns[1].HeaderText = "Nro Cheque";
            Grilla.Columns[6].HeaderText = "Fecha Vto";
            Grilla.Columns[0].Visible    = false;
            Grilla.Columns[4].Visible    = false;
            Grilla.Columns[1].Width      = 160;
            Grilla.Columns[2].Width      = 150;
            Grilla.Columns[3].Width      = 150;
            Grilla.Columns[5].Width      = 150;
            Grilla.Columns[7].Visible    = false;
            txtTotal.Text = fun.TotalizarColumna(trdo, "Saldo").ToString();
            txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text);
        }
Ejemplo n.º 3
0
        public void BuscarCheque(Int32 CodVenta)
        {
            string    values = "";
            cCheque   cheque = new cCheque();
            DataTable trdo   = cheque.GetChequexCodVenta(CodVenta);

            if (trdo.Rows.Count >= 0)
            {
                for (int i = 0; i < trdo.Rows.Count; i++)
                {
                    string NroCheque = trdo.Rows[i]["NroCheque"].ToString();
                    string Fecha     = trdo.Rows[i]["Fecha"].ToString();
                    string Importe   = trdo.Rows[i]["Importe"].ToString();
                    values    = NroCheque;
                    values    = values + ";" + Fecha;
                    values    = values + ";" + Importe;
                    tbCheques = fun.AgregarFilas(tbCheques, values);
                }
                GrillaCheques.DataSource = tbCheques;
                txtTotalCheque.Text      = fun.TotalizarColumna(tbCheques, "Importe").ToString();
                if (txtTotalCheque.Text != "")
                {
                    txtTotalCheque.Text = fun.FormatoEnteroMiles(txtTotalCheque.Text);
                }
                GrillaCheques.Columns[0].Width = 390;
            }
        }
Ejemplo n.º 4
0
        private double GetSaldoCheque(Int32 CodOrden)
        {
            cCheque cheque = new cCheque();
            double  Saldo  = 0;

            Saldo = cheque.GetSaldoChequexCodOrden(CodOrden);
            return(Saldo);
        }
Ejemplo n.º 5
0
        private void Buscar()
        {
            cMovimiento mov      = new cMovimiento();
            double      Efectivo = mov.GetTotalEfectivo();

            txtEfectivo.Text = Efectivo.ToString();
            txtEfectivo.Text = fun.SepararDecimales(txtEfectivo.Text);
            txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text);
            cDocumento doc        = new cDocumento();
            double     ImporteDoc = doc.GetTotalDocumentos();

            txtDocumentos.Text = ImporteDoc.ToString();
            txtDocumentos.Text = fun.SepararDecimales(txtDocumentos.Text);
            txtDocumentos.Text = fun.FormatoEnteroMiles(txtDocumentos.Text);
            cCobroTarjeta cobro = new cCobroTarjeta();

            txtTotalTarjeta.Text = cobro.GetTotal().ToString();
            txtTotalTarjeta.Text = fun.SepararDecimales(txtTotalTarjeta.Text);
            txtTotalTarjeta.Text = fun.FormatoEnteroMiles(txtTotalTarjeta.Text);
            cCheque cheque = new cCheque();

            txtTotalCheque.Text = cheque.GetTotalCheque().ToString();
            txtTotalCheque.Text = fun.SepararDecimales(txtTotalCheque.Text);
            txtTotalCheque.Text = fun.FormatoEnteroMiles(txtTotalCheque.Text);

            cGarantia garantia = new cGarantia();

            txtGarantia.Text = garantia.GetTotalGarantia().ToString();
            txtGarantia.Text = fun.SepararDecimales(txtGarantia.Text);
            txtGarantia.Text = fun.FormatoEnteroMiles(txtGarantia.Text);

            cInsumo insumo = new cInsumo();

            txtTotalInsumo.Text = insumo.GetTotalInsumo().ToString();
            txtTotalInsumo.Text = fun.SepararDecimales(txtTotalInsumo.Text);
            txtTotalInsumo.Text = fun.FormatoEnteroMiles(txtTotalInsumo.Text);

            cVale vale = new cVale();

            txtTotalVale.Text = vale.GetTotalVales().ToString();
            txtTotalVale.Text = fun.SepararDecimales(txtTotalVale.Text);
            txtTotalVale.Text = fun.FormatoEnteroMiles(txtTotalVale.Text);

            cTransferencia tra = new Clases.cTransferencia();

            txtTotalTransferencia.Text = tra.GetTotal().ToString();
            txtTotalTransferencia.Text = fun.SepararDecimales(txtTotalTransferencia.Text);
            txtTotalTransferencia.Text = fun.FormatoEnteroMiles(txtTotalTransferencia.Text);

            cCuentaCorriente cuenta        = new cCuentaCorriente();
            Double           ImporteCuenta = cuenta.GetTotal();

            txtCuentaCorriente.Text = ImporteCuenta.ToString();
            txtCuentaCorriente.Text = fun.SepararDecimales(txtCuentaCorriente.Text);
            txtCuentaCorriente.Text = fun.FormatoEnteroMiles(txtCuentaCorriente.Text);
        }
Ejemplo n.º 6
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (txtaPagar.Text == "")
            {
                Mensaje("Debe ingresar un monto");
            }

            double aPagar = fun.ToDouble(txtaPagar.Text);
            double Saldo  = fun.ToDouble(txtSaldo.Text);

            if (aPagar > Saldo)
            {
                Mensaje("El monto a pagar supera el saldo");
                return;
            }

            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha Ingresada es incorrecta");
                return;
            }

            DateTime      Fecha = Convert.ToDateTime(txtFecha.Text);
            SqlConnection con   = new SqlConnection(cConexion.Cadenacon());

            con.Open();
            SqlTransaction tranOrden;

            tranOrden = con.BeginTransaction("TranOrden");
            try
            {
                Int32        CodOrden  = Convert.ToInt32(txtOrden.Text);
                Int32        CodCheque = Convert.ToInt32(frmPrincipal.CodigoPrincipal);
                cCobroCheque objCobro  = new cCobroCheque();
                objCobro.RegistrarPago(con, tranOrden, CodCheque, aPagar, Fecha);
                cCheque objCheque = new cCheque();
                objCheque.CobroCheque(con, tranOrden, CodCheque, aPagar);
                cMovimiento mov         = new cMovimiento();
                string      Descripcion = "COBRO DE CHEQUE " + txtNroCheque.Text;
                mov.GrabarMovimientoTransaccion(con, tranOrden, aPagar, Descripcion, Fecha, 1, CodOrden);
                tranOrden.Commit();
                con.Close();
                Buscar(CodCheque);
                Mensaje("Datos Grabados Correctamente");
            }
            catch (Exception ex)
            {
                tranOrden.Rollback();
                Mensaje("Hubo un error en el proceso de grabación");
            }
        }
Ejemplo n.º 7
0
        private void Buscar(Int32 CodCheque)
        {
            cCheque   cheque = new cCheque();
            DataTable trdo   = cheque.GetChequexCodigo(CodCheque);

            if (trdo.Rows.Count > 0)
            {
                txtImporte.Text   = trdo.Rows[0]["Importe"].ToString();
                txtSaldo.Text     = trdo.Rows[0]["Saldo"].ToString();
                txtNroCheque.Text = trdo.Rows[0]["NroCheque"].ToString();
                txtOrden.Text     = trdo.Rows[0]["CodOrden"].ToString();
            }
            if (txtImporte.Text != "")
            {
                txtImporte.Text = fun.SepararDecimales(txtImporte.Text);
                txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text);
            }

            if (txtSaldo.Text != "")
            {
                txtSaldo.Text = fun.SepararDecimales(txtSaldo.Text);
                txtSaldo.Text = fun.FormatoEnteroMiles(txtSaldo.Text);
            }

            cCobroCheque objCobro = new cCobroCheque();
            DataTable    tresul   = objCobro.GetCobroChequexCodCheque(CodCheque);

            Grilla.DataSource         = tresul;
            Grilla.Columns[0].Visible = false;
            Grilla.Columns[1].Visible = false;
            Grilla.Columns[2].Width   = 130;
            Grilla.Columns[3].Width   = 130;
            if (txtSaldo.Text == "0")
            {
                btnAnular.Enabled = true;
                btnGrabar.Enabled = false;
            }
            else
            {
                btnAnular.Enabled = false;
                btnGrabar.Enabled = true;
            }
        }
Ejemplo n.º 8
0
        private void GrabarFormaPago(SqlConnection con, SqlTransaction Transaccion, Int32?CodOrden, Int32?CodVenta)
        {
            DateTime Fecha      = Convert.ToDateTime(txtFechaAltaOrden.Text);
            Int32    CodUsuario = 1;

            cMovimiento mov         = new cMovimiento();
            string      Descripcion = "VENTA DE REPUESTO ";
            Int32       CodCliente  = Convert.ToInt32(txtCodCliente.Text);

            // Descripcion = Descripcion + " " + txtApellido.Text;
            //  Descripcion = Descripcion + " " + txtNombre.Text;
            //  Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            if (txtEfectivo.Text != "" && txtEfectivo.Text != "0")
            {
                double Efectivo = fun.ToDouble(txtEfectivo.Text);
                mov.GrabarMovimientoTransaccion(con, Transaccion, Efectivo, Descripcion, Fecha, CodUsuario, CodOrden);
            }

            if (txtDocumento.Text != "" && txtDocumento.Text != "0")
            {
                double     Importe = fun.ToDouble(txtDocumento.Text);
                cDocumento doc     = new cDocumento();
                doc.InsertarDocumentoTransaccion(con, Transaccion, Fecha, Importe, CodOrden, CodCliente, CodVenta);
            }

            if (txtTotalTarjeta.Text != "" && txtTotalTarjeta.Text != "0")
            {
                cCobroTarjeta cobro = new cCobroTarjeta();
                for (int k = 0; k < tbTarjeta.Rows.Count; k++)
                {
                    double   ImporteTarjeta = Convert.ToDouble(tbTarjeta.Rows[k]["Importe"].ToString());
                    Int32    Codtarjeta     = Convert.ToInt32(tbTarjeta.Rows[k]["CodTarjeta"].ToString());
                    string   Cupon          = tbTarjeta.Rows[k]["Cupon"].ToString();
                    DateTime FechaEmision   = Convert.ToDateTime(tbTarjeta.Rows[k]["FechaEmision"].ToString());
                    Double?  Recargo        = null;
                    if (tbTarjeta.Rows[k]["Recargo"].ToString() != "")
                    {
                        Recargo = Convert.ToDouble(tbTarjeta.Rows[k]["Recargo"].ToString());
                    }
                    cobro.Registrar(con, Transaccion, CodOrden, Fecha, Codtarjeta, ImporteTarjeta, Cupon, FechaEmision, Recargo, CodCliente, Convert.ToInt32(CodVenta));
                }
            }

            if (txtTotalCheque.Text != "" && txtTotalCheque.Text != "0")
            {
                cCheque cheque = new cCheque();
                for (int i = 0; i < tbCheques.Rows.Count; i++)
                {
                    string   NroCheque = tbCheques.Rows[i]["NroCheque"].ToString();
                    DateTime FechaVto  = Convert.ToDateTime(tbCheques.Rows[i]["Fecha"].ToString());
                    double   Importe   = fun.ToDouble(tbCheques.Rows[i]["Importe"].ToString());
                    cheque.InsertarCheque(con, Transaccion, NroCheque, Importe, CodOrden, Fecha, FechaVto, CodCliente, Convert.ToInt32(CodVenta));
                }
            }

            /*
             * if (txtImporteGarantia.Text != "" && txtImporteGarantia.Text != "0")
             * {
             *  double ImporteGarantia = fun.ToDouble(txtImporteGarantia.Text);
             *  cGarantia objGarantia = new cGarantia();
             *  objGarantia.Insertar(con, Transaccion, ImporteGarantia, CodOrden, Fecha);
             * }
             * */
        }
Ejemplo n.º 9
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            int ConDeuda = 0;

            if (ChkVencida.Checked == true)
            {
                ConDeuda = 1;
            }
            Clases.cFunciones fun    = new Clases.cFunciones();
            DataTable         tResul = fun.CrearTabla("Codigo;Tipo;Cuota;Patente;Descripcion;Apellido;Telefono;Celular;Importe;Saldo;Vencimiento");

            if (txtPatente.Text == "" && txtApellido.Text == "")
            {
                Mensaje("Debe ingresar un criterio de búsqueda");
                return;
            }
            DateTime  Fecha = Convert.ToDateTime(txtFecha.Text);
            string    Valor = "";
            cCuota    cuota = new cCuota();
            DataTable trdo  = cuota.GetCuotasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < trdo.Rows.Count; i++)
            {
                Valor  = trdo.Rows[i]["CodVenta"].ToString();
                Valor  = Valor + ";" + "Cuotas";
                Valor  = Valor + ";" + trdo.Rows[i]["Cuota"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCuotasAnteriores cuotasAnt  = new cCuotasAnteriores();
            DataTable         tcuotasAnt = cuotasAnt.GetCuotasAnterioresAdeudades(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcuotasAnt.Rows.Count; i++)
            {
                Valor  = tcuotasAnt.Rows[i]["CodGrupo"].ToString();
                Valor  = Valor + ";" + "Doc. Anteriores";
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Cuota"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCobranza cob  = new cCobranza();
            DataTable tcob = cob.GetCobranzasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcob.Rows.Count; i++)
            {
                Valor  = tcob.Rows[i]["CodCobranza"].ToString();
                Valor  = Valor + ";" + "Cobranza";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tcob.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["FechaCompromiso"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCheque   cheque  = new cCheque();
            DataTable tcheque = cheque.GetChequesAdeudados(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcheque.Rows.Count; i++)
            {
                Valor  = tcheque.Rows[i]["CodVenta"].ToString();
                Valor  = Valor + ";" + "Cheque";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tcheque.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cPrenda   prenda  = new cPrenda();
            DataTable tPrenda = prenda.GetPrendasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tPrenda.Rows.Count; i++)
            {
                Valor  = tPrenda.Rows[i]["CodPrenda"].ToString();
                Valor  = Valor + ";" + "Prenda";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tPrenda.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCobranzaGeneral cobGen = new cCobranzaGeneral();
            // if (txtApellido.Text != "")
            // {
            DataTable tCobGen = cobGen.GetDedudaCobranzaGeneral(txtApellido.Text, txtPatente.Text);

            for (int i = 0; i < tCobGen.Rows.Count; i++)
            {
                Valor  = tCobGen.Rows[i]["CodCobranza"].ToString();
                Valor  = Valor + ";" + "Cobranza General";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tCobGen.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Cliente"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";";
                Valor  = Valor + ";" + tCobGen.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            //}
            //DateTime Fecha = Convert.ToDateTime(txtFecha.Text);
            DateTime FechaDesde = Fecha.AddDays(-200);
            DateTime FechaHasta = Fecha.AddDays(10);

            Clases.cAlarma alarma  = new Clases.cAlarma();
            DataTable      talarma = alarma.GetAlertasxRangoFecha(FechaDesde, FechaHasta, "", txtPatente.Text, txtApellido.Text);

            for (int i = 0; i < talarma.Rows.Count; i++)
            {
                Valor  = talarma.Rows[i]["CodAlarma"].ToString();
                Valor  = Valor + ";" + "Alerta";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + talarma.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + talarma.Rows[i]["Nombre"].ToString();
                Valor  = Valor + ";" + talarma.Rows[i]["Cliente"].ToString();
                Valor  = Valor + ";" + "";
                Valor  = Valor + ";";
                Valor  = Valor + ";" + "0";
                Valor  = Valor + ";" + "0";
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            Double TotalImporte = 0;
            Double TotalSaldo   = 0;

            TotalImporte              = fun.TotalizarColumna(tResul, "Importe");
            TotalSaldo                = fun.TotalizarColumna(tResul, "Saldo");
            Valor                     = ";" + "Total";
            Valor                     = Valor + ";;;;;;";
            Valor                     = Valor + ";" + TotalImporte.ToString();
            Valor                     = Valor + ";" + TotalSaldo.ToString();
            Valor                     = Valor + ";";
            tResul                    = fun.AgregarFilas(tResul, Valor);
            tResul                    = fun.TablaaMiles(tResul, "Importe");
            tResul                    = fun.TablaaMiles(tResul, "Saldo");
            Grilla.DataSource         = tResul;
            Grilla.Columns[0].Visible = false;
            Pintar();
            for (int i = 0; i < Grilla.Rows.Count - 1; i++)
            {
                if (i == (Grilla.Rows.Count - 2))
                {
                    Grilla.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
                }
            }
        }
Ejemplo n.º 10
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            int ConDeuda = 0;

            if (ChkVencida.Checked == true)
            {
                ConDeuda = 1;
            }
            Clases.cFunciones fun      = new Clases.cFunciones();
            Int32?            CodOrden = null;
            DataTable         tResul   = fun.CrearTabla("Codigo;Tipo;Orden;Patente;Descripcion;Apellido;Telefono;Celular;Importe;Saldo;Fecha;Vencimiento;Cupon");

            if (txtPatente.Text == "" && txtApellido.Text == "" && txtCodOrden.Text == "")
            {
                CodOrden = -1;
            }

            if (txtCodOrden.Text != "")
            {
                CodOrden = Convert.ToInt32(txtCodOrden.Text);
            }
            string Cupon = "";

            if (txtCupon.Text != "")
            {
                Cupon = txtCupon.Text;
            }

            DateTime  Fecha   = Convert.ToDateTime(txtFecha.Text);
            string    Valor   = "";
            cCheque   cheque  = new cCheque();
            DataTable tcheque = cheque.GetChequesAdeudados(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda, CodOrden);

            for (int i = 0; i < tcheque.Rows.Count; i++)
            {
                Valor = tcheque.Rows[i]["CodCheque"].ToString();
                Valor = Valor + ";" + "Cheque";
                Valor = Valor + ";" + tcheque.Rows[i]["CodOrden"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Patente"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Descripcion1"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Apellido"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Telefono"].ToString();
                Valor = Valor + ";"; //+ tcheque.Rows[i]["Celular"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["Fecha"].ToString();
                Valor = Valor + ";" + tcheque.Rows[i]["FechaVto"].ToString();
                Valor = Valor + "; ";
                if (Cupon == "")
                {
                    tResul = fun.AgregarFilas(tResul, Valor);
                }
            }

            cGarantia garant = new cGarantia();
            DataTable tGar   = garant.GetGarantiasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda, CodOrden);

            for (int i = 0; i < tGar.Rows.Count; i++)
            {
                Valor = tGar.Rows[i]["CodGarantia"].ToString();
                Valor = Valor + ";" + "Garantía";
                Valor = Valor + ";" + tGar.Rows[i]["CodOrden"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Patente"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Descripcion1"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Apellido"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Telefono"].ToString();
                Valor = Valor + ";"; //+ tcheque.Rows[i]["Celular"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tGar.Rows[i]["Fecha"].ToString();
                Valor = Valor + "; ";
                Valor = Valor + "; ";
                if (Cupon == "")
                {
                    tResul = fun.AgregarFilas(tResul, Valor);
                }
            }

            cDocumento doc  = new cDocumento();
            DataTable  tdoc = doc.GetDocumentosAdeudados(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda, CodOrden);

            for (int i = 0; i < tdoc.Rows.Count; i++)
            {
                Valor = tdoc.Rows[i]["CodDocumento"].ToString();
                Valor = Valor + ";" + "Documento";
                Valor = Valor + ";" + tdoc.Rows[i]["CodOrden"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Patente"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Descripcion1"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Apellido"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Telefono"].ToString();
                Valor = Valor + ";"; //+ tcheque.Rows[i]["Celular"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Importe"].ToString();

                Valor = Valor + ";" + tdoc.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tdoc.Rows[i]["Fecha"].ToString();
                Valor = Valor + "; ";
                Valor = Valor + "; ";
                if (Cupon == "")
                {
                    tResul = fun.AgregarFilas(tResul, Valor);
                }
            }

            cCobroTarjeta cobro  = new cCobroTarjeta();
            DataTable     tcobro = cobro.GetCobrotarjetaAdeudada(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda, CodOrden, Cupon);

            for (int i = 0; i < tcobro.Rows.Count; i++)
            {
                Valor = tcobro.Rows[i]["CodCobro"].ToString();
                Valor = Valor + ";" + "Tarjeta";
                Valor = Valor + ";" + tcobro.Rows[i]["CodOrden"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Patente"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Descripcion1"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Apellido"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Telefono"].ToString();
                Valor = Valor + ";"; //+ tcheque.Rows[i]["Celular"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Importe"].ToString();

                Valor = Valor + ";" + tcobro.Rows[i]["Importe"].ToString();
                Valor = Valor + ";" + tcobro.Rows[i]["Fecha"].ToString();
                Valor = Valor + "; ";
                Valor = Valor + ";" + tcobro.Rows[i]["Cupon"].ToString();

                tResul = fun.AgregarFilas(tResul, Valor);
            }
            double Total = fun.TotalizarColumna(tResul, "Saldo");

            txtTotal.Text             = Total.ToString();
            txtTotal.Text             = fun.FormatoEnteroMiles(txtTotal.Text);
            tResul                    = fun.TablaaMiles(tResul, "Importe");
            tResul                    = fun.TablaaMiles(tResul, "Saldo");
            Grilla.DataSource         = tResul;
            Grilla.Columns[0].Visible = false;
            //Grilla.Columns[4].Visible = false;
            Grilla.Columns[7].Visible = false;
            Pintar();
        }
Ejemplo n.º 11
0
        private void GetRentabilidad()
        {
            cCobroTarjeta objCobro = new cCobroTarjeta();

            Clases.cFunciones fun        = new Clases.cFunciones();
            DateTime          FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime          FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            cOrden            orden      = new cOrden();

            txtCantidad.Text = orden.CantidadOrdenes(FechaDesde, FechaHasta).ToString();

            double Efectivo = orden.GetTotalEfectivo(FechaDesde, FechaHasta);

            txtEfectivo.Text = Efectivo.ToString();
            if (txtEfectivo.Text != "")
            {
                txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text);
            }

            double        TotalTarjeta = 0;
            cCobroTarjeta cobro        = new cCobroTarjeta();

            TotalTarjeta = cobro.GetTotalTarjeta(FechaDesde, FechaHasta);

            //
            Double Saldo = cobro.GetSaldoxFecha(FechaDesde, FechaHasta);

            txtDiferenciaTarjeta.Text = Saldo.ToString();

            TotalTarjeta    = TotalTarjeta - Saldo;
            txtTarjeta.Text = TotalTarjeta.ToString();
            if (txtTarjeta.Text != "")
            {
                txtTarjeta.Text = fun.FormatoEnteroMiles(txtTarjeta.Text);
            }

            if (txtDiferenciaTarjeta.Text != "")
            {
                txtDiferenciaTarjeta.Text = fun.FormatoEnteroMiles(txtDiferenciaTarjeta.Text);
            }

            cDocumento doc         = new cDocumento();
            double     ImporteDocu = doc.GetTotalDocumento(FechaDesde, FechaHasta);

            txtImporteDocumento.Text = ImporteDocu.ToString();

            if (txtImporteDocumento.Text != "")
            {
                txtImporteDocumento.Text = fun.FormatoEnteroMiles(txtImporteDocumento.Text);
            }

            cCheque cheque        = new cCheque();
            double  ImporteCheque = cheque.GetTotalChequexFecha(FechaDesde, FechaHasta);

            txtcheque.Text = ImporteCheque.ToString();
            if (txtcheque.Text != "")
            {
                txtcheque.Text = fun.FormatoEnteroMiles(txtcheque.Text);
            }



            cGarantia garantia        = new cGarantia();
            double    ImporteGarantia = garantia.GetTotalGarantiaxFecha(FechaDesde, FechaHasta);

            txtGarantia.Text = ImporteGarantia.ToString();

            if (txtGarantia.Text != "")
            {
                txtGarantia.Text = fun.FormatoEnteroMiles(txtGarantia.Text);
            }

            cCuentaCorriente cc = new cCuentaCorriente();
            Double           ImporteCuentaCorriene = 0;

            ImporteCuentaCorriene        = cc.GetTotalCuentaxFecha(FechaDesde, FechaHasta);
            txtTotalCuentaCorriente.Text = ImporteCuentaCorriene.ToString();
            if (txtTotalCuentaCorriente.Text != "")
            {
                txtTotalCuentaCorriente.Text = fun.FormatoEnteroMiles(txtTotalCuentaCorriente.Text);
            }

            cTransferencia tranfer = new cTransferencia();
            Double         ImporteTransferencia = tranfer.GetTotalTransferencia(FechaDesde, FechaHasta);

            txtTotalTransferencia.Text = ImporteTransferencia.ToString();
            if (txtTotalTransferencia.Text != "")
            {
                txtTotalTransferencia.Text = fun.FormatoEnteroMiles(txtTotalTransferencia.Text);
            }

            double TotalFacturado = Efectivo + TotalTarjeta + ImporteDocu + ImporteCheque + ImporteGarantia + ImporteCuentaCorriene + ImporteTransferencia;

            txtTotalFacturado.Text = TotalFacturado.ToString();
            if (txtTotalFacturado.Text != "")
            {
                txtTotalFacturado.Text = fun.FormatoEnteroMiles(txtTotalFacturado.Text);
            }

            double GananciaInsumos = orden.GetGananciaInsumo(FechaDesde, FechaHasta);
            double RecargoTarjeta  = objCobro.GetTotalRecargoTarjeta(FechaDesde, FechaHasta);

            double VentaInsumo = orden.GetVentaInsumo(FechaDesde, FechaHasta);
            double CostoInsumo = orden.GetCostoInsumo(FechaDesde, FechaHasta);

            txtVentaInsumos.Text = VentaInsumo.ToString();
            txtCostoInsumo.Text  = CostoInsumo.ToString();

            double GananciaInsuloMostrador = 0;

            cVenta objVenta       = new cVenta();
            double CostoMostrador = 0;

            CostoMostrador = objVenta.GetCostoInsumoVenta(FechaDesde, FechaHasta);
            txtCostoInsumoMostrador.Text = CostoMostrador.ToString();
            //GetVentaInsumoVenta

            double VentaMostrador = 0;

            VentaMostrador         = objVenta.GetVentaInsumoVenta(FechaDesde, FechaHasta);
            txtVentaMostrador.Text = VentaMostrador.ToString();

            if (txtCostoInsumoMostrador.Text != "")
            {
                txtCostoInsumoMostrador.Text = fun.FormatoEnteroMiles(txtCostoInsumoMostrador.Text);
            }

            if (txtVentaMostrador.Text != "")
            {
                txtVentaMostrador.Text = fun.FormatoEnteroMiles(txtVentaMostrador.Text);
            }

            if (txtVentaInsumos.Text != "")
            {
                txtVentaInsumos.Text = fun.FormatoEnteroMiles(txtVentaInsumos.Text);
            }

            if (txtCostoInsumo.Text != "")
            {
                txtCostoInsumo.Text = fun.FormatoEnteroMiles(txtCostoInsumo.Text);
            }

            txtGananciaInsumos.Text = GananciaInsumos.ToString();

            if (txtGananciaInsumos.Text != "")
            {
                txtGananciaInsumos.Text = fun.FormatoEnteroMiles(txtGananciaInsumos.Text);
            }

            GananciaInsuloMostrador   = VentaMostrador - CostoMostrador;
            txtGananciaMostrador.Text = GananciaInsuloMostrador.ToString();
            if (txtGananciaMostrador.Text != "")
            {
                txtGananciaMostrador.Text = fun.FormatoEnteroMiles(txtGananciaMostrador.Text);
            }

            double GananciaMo = orden.GetGananciaManoObra(FechaDesde, FechaHasta);

            txtManoObra.Text = GananciaMo.ToString();

            if (txtManoObra.Text != "")
            {
                txtManoObra.Text = fun.FormatoEnteroMiles(txtManoObra.Text);
            }

            double TotalGanancia = GananciaInsumos + GananciaMo + RecargoTarjeta + GananciaInsuloMostrador - Saldo;

            txtTotalGanancia.Text = TotalGanancia.ToString();
            if (txtTotalGanancia.Text != "")
            {
                txtTotalGanancia.Text = fun.FormatoEnteroMiles(txtTotalGanancia.Text);
            }

            double         GastoAlquiler = 0;
            cGastosNegocio gasto         = new cGastosNegocio();
            Int32?         CodEntidad    = 11;

            GastoAlquiler         = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad);
            txtGastoAlquiler.Text = GastoAlquiler.ToString();
            if (txtGastoAlquiler.Text != "")
            {
                txtGastoAlquiler.Text = fun.FormatoEnteroMiles(txtGastoAlquiler.Text);
            }

            double Sueldos = 0;

            CodEntidad = 6;

            Sueldos        = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad);
            txtSueldo.Text = Sueldos.ToString();
            if (txtSueldo.Text != "")
            {
                txtSueldo.Text = fun.FormatoEnteroMiles(txtSueldo.Text);
            }

            double Combustible = 0;

            CodEntidad = 13;

            Combustible         = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad);
            txtCombustible.Text = Combustible.ToString();
            if (txtCombustible.Text != "")
            {
                txtCombustible.Text = fun.FormatoEnteroMiles(txtCombustible.Text);
            }

            double Impuestos = 0;

            CodEntidad = 2;

            Impuestos        = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad);
            txtImpuesto.Text = Impuestos.ToString();
            if (txtImpuesto.Text != "")
            {
                txtImpuesto.Text = fun.FormatoEnteroMiles(txtImpuesto.Text);
            }

            double Varios = 0;

            CodEntidad = null;

            Varios = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad);
            Varios = Varios - Sueldos - Impuestos - Combustible - GastoAlquiler;
            txtOtrosGastos.Text = Varios.ToString();
            if (txtOtrosGastos.Text != "")
            {
                txtOtrosGastos.Text = fun.FormatoEnteroMiles(txtOtrosGastos.Text);
            }
            double TotalGastos = 0;

            TotalGastos         = Varios + Sueldos + Impuestos + Combustible + GastoAlquiler; //+Saldo;
            txtTotalGastos.Text = TotalGastos.ToString();
            if (txtTotalGastos.Text != "")
            {
                txtTotalGastos.Text = fun.FormatoEnteroMiles(txtTotalGastos.Text);
            }

            double Rentabilidad = TotalGanancia - TotalGastos;

            txtRentabilidad.Text = Rentabilidad.ToString();
            if (txtRentabilidad.Text != "")
            {
                txtRentabilidad.Text = fun.FormatoEnteroMiles(txtRentabilidad.Text);
            }

            double SaldoGarantia = garantia.GetTotalSaldoGarantiaxFecha(FechaDesde, FechaHasta);

            txtSaldoGarantia.Text = SaldoGarantia.ToString();

            if (txtSaldoGarantia.Text != "")
            {
                txtSaldoGarantia.Text = fun.FormatoEnteroMiles(txtSaldoGarantia.Text);
            }

            double TotalSaldoTarjeta = cobro.GetTotalSaldoTarjeta(FechaDesde, FechaHasta);

            txtSaldoTarjeta.Text = TotalSaldoTarjeta.ToString();

            if (txtSaldoTarjeta.Text != "")
            {
                txtSaldoTarjeta.Text = fun.FormatoEnteroMiles(txtSaldoTarjeta.Text);
            }

            double ImporteSaldoDoc = doc.GetTotalSaldoDocumento(FechaDesde, FechaHasta);

            txtSaldoDocumento.Text = ImporteSaldoDoc.ToString();

            if (txtSaldoDocumento.Text != "")
            {
                txtSaldoDocumento.Text = fun.FormatoEnteroMiles(txtSaldoDocumento.Text);
            }

            double ImporteSaldoCheque = cheque.GetTotalSaldoChequexFecha(FechaDesde, FechaHasta);

            txtSaldoCheque.Text = ImporteSaldoCheque.ToString();
            if (txtSaldoCheque.Text != "")
            {
                txtSaldoCheque.Text = fun.FormatoEnteroMiles(txtSaldoCheque.Text);
            }
        }
Ejemplo n.º 12
0
        private void EliminarOrden(Int32 CodOrden)
        {
            Double ImporteCobrodoDocumento = 0;
            Int32  CodDocumentoa           = 0;
            Double ImporteEfectivoOrden    = 0;
            Double ImporteCobradoTarjeta   = 0;
            Double ImporteGatantia         = 0;
            Double ImporteCheque           = 0;

            cOrden          orden       = new cOrden();
            cCobroDocumento cob         = new cCobroDocumento();
            cCobroTarjeta   cobTarj     = new cCobroTarjeta();
            cGarantia       garantia    = new Clases.cGarantia();
            cCobroCheque    cobroCheque = new cCobroCheque();
            cCheque         cheque      = new cCheque();

            ImporteEfectivoOrden    = orden.GetTotalEfectivoOrden(CodOrden);
            ImporteCobrodoDocumento = cob.GetTotalDocumentoCobrado(CodOrden);
            CodDocumentoa           = cob.GetCodDocumentoxCodOrden(CodOrden);
            ImporteCobradoTarjeta   = cobTarj.GetImporteCobradoxCodOrden(CodOrden);
            ImporteGatantia         = garantia.GetImporteCobradoxCodOrden(CodOrden);
            ImporteCheque           = cobroCheque.GetTotalChequeCobrado(CodOrden);

            cMovimiento mov = new cMovimiento();
            cDocumento  doc = new cDocumento();


            SqlConnection con         = new SqlConnection(cConexion.Cadenacon());
            DateTime      Fecha       = DateTime.Now;
            string        Descripcion = "";

            con.Open();
            SqlTransaction tran;

            tran = con.BeginTransaction("TranOrden");
            try
            {
                if (ImporteEfectivoOrden > 0)
                {
                    Descripcion = "Anulación Cobro de efectivo, Orden " + CodOrden.ToString();
                    mov.GrabarMovimientoTransaccion(con, tran, -1 * ImporteEfectivoOrden, Descripcion, Fecha, Principal.CodUsuarioLogueado, null);
                }

                if (ImporteCobradoTarjeta > 0)
                {
                    Descripcion = "Anulación Cobro de tarjeta, Orden " + CodOrden.ToString();
                    mov.GrabarMovimientoTransaccion(con, tran, -1 * ImporteCobradoTarjeta, Descripcion, Fecha, Principal.CodUsuarioLogueado, null);
                }

                if (ImporteGatantia > 0)
                {
                    Descripcion = "Anulación Cobro de garantía, Orden " + CodOrden.ToString();
                    mov.GrabarMovimientoTransaccion(con, tran, -1 * ImporteGatantia, Descripcion, Fecha, Principal.CodUsuarioLogueado, null);
                }

                if (ImporteCheque > 0)
                {
                    //saco los codcheque para borrar los cobros cheques
                    DataTable tbcheque = cheque.GetChquesxCodOrden(CodOrden);
                    if (tbcheque.Rows.Count > 0)
                    {
                        for (int i = 0; i < tbcheque.Rows.Count; i++)
                        {
                            if (tbcheque.Rows[i]["CodCheque"].ToString() != "")
                            {
                                Int32 CodCheque = Convert.ToInt32(tbcheque.Rows[i]["CodCheque"].ToString());
                                cobroCheque.BorrarCobroCheque(con, tran, CodCheque);
                            }
                        }
                    }

                    Descripcion = "Anulación Cobro de cheque, Orden " + CodOrden.ToString();
                    mov.GrabarMovimientoTransaccion(con, tran, -1 * ImporteCheque, Descripcion, Fecha, Principal.CodUsuarioLogueado, null);
                }

                if (ImporteCobrodoDocumento > 0)
                {
                    Descripcion = "Anulación Cobro de Documento, Orden " + CodOrden.ToString();
                    cob.BorrarCobroDocumentoxCodDocumento(con, tran, CodDocumentoa);
                    mov.GrabarMovimientoTransaccion(con, tran, -1 * ImporteCobrodoDocumento, Descripcion, Fecha, Principal.CodUsuarioLogueado, null);
                }
                cTransferencia transferencia = new cTransferencia();
                garantia.BorrarGarantia(con, tran, CodOrden);
                cheque.BorrarchquexCodOrden(con, tran, CodOrden);
                doc.BorrarDocumentoxCodOrden(con, tran, CodOrden);
                cobTarj.BorrarCobroTarjeta(con, tran, CodOrden);
                orden.EliminarOrden(con, tran, CodOrden);
                transferencia.BorrarTransferencia(con, tran, CodOrden);
                tran.Commit();
                Mensaje("Orden de Trabajo eliminada correctamente, se actualizaron las cuentas");
                con.Close();
                Buscar();
            }
            catch (Exception)
            {
                tran.Rollback();
                con.Close();
                Mensaje("Hubo un error en el proceso de anulación");
                throw;
            }
        }