Esempio n. 1
0
        public static facturacionBaseObj getVentasStatus(string ID)
        {
            facturacionBaseObj pfactura = new facturacionBaseObj();

            using (SqlConnection con = DBcomun.getConnection())
            {
                SqlCommand    comand = new SqlCommand(string.Format("SELECT * FROM ventaFacturacion WHERE ID = '{0}'", ID), con);
                SqlDataReader re     = comand.ExecuteReader();
                if (re.HasRows)
                {
                    while (re.Read())
                    {
                        pfactura.ID                    = re["ID"].ToString();
                        pfactura.Cliente_ID            = re["clienteID"].ToString();
                        pfactura.Service_ID            = re["serviceID"].ToString();
                        pfactura.Case_ID               = re["caseID"].ToString();
                        pfactura.TotalPago_Mensualidad = Convert.ToDouble(re["TotalPago"]).ToString("f2");
                        pfactura.Abono_Deposito        = Convert.ToDouble(re["Abono"]).ToString("f2");
                        pfactura.fechaUltimoPago       = re["ultimoPago"].ToString();
                    }
                }
                else
                {
                    pfactura = null;
                }
                con.Close();
            }
            return(pfactura);
        }
Esempio n. 2
0
 // when seleccionar button is clicked.
 private void btnSeleccionar_Click(object sender, EventArgs e)
 {
     string ID = "", Servicio = "";
     if (dgvFacturacion.SelectedRows.Count == 1)
     {
         ID = dgvFacturacion.CurrentRow.Cells[0].Value.ToString();
         Servicio = dgvFacturacion.CurrentRow.Cells[1].Value.ToString();
         try {
             if (rbAlquiler.Checked == true)
             {
                 cleanInputs();
                 pBaseObjfactura = facturacion.getRentStatus(ID);
                 pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                 pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                 dbMensualidad.Checked = true;
                 gbPagoRealizar.Visible = true;
                 if(Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                 {
                     rbPasaporte.Checked = true;
                 }
                 else
                 {
                     rbCedula.Checked = true;
                 }
                 txtCedula.Text = pCliente.Cedula;
                 txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                 txtServicio.Text = pService.Servicio;
                 pbCedula.Image = Image.FromFile(pCliente.Image);
                 if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                 {
                     txtUltimoPago.Text = "No se ha hecho un pago aun";
                 }
                 else
                 {
                     txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                 }
                 gbParametrosBusqueda.Enabled = false;
             }
             else if (rbVentas.Checked == true)
             {
                 // ventas
                 cleanInputs();
                 pBaseObjfactura = facturacion.getVentasStatus(ID);
                 pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                 pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                 txtBalanceTotal.Text = pBaseObjfactura.TotalPago_Mensualidad;
                 if (Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                 {
                     rbPasaporte.Checked = true;
                 }
                 else
                 {
                     rbCedula.Checked = true;
                 }
                 txtCedula.Text = pCliente.Cedula;
                 txtImpSobreRenta.Text = "Incluido";
                 txtITEBIS.Text = "Incluido";
                 txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                 txtServicio.Text = pService.Servicio;
                 txtTotalaPagar.Text = pBaseObjfactura.TotalPago_Mensualidad;
                 if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                 {
                     txtUltimoPago.Text = "No se ha hecho un pago aun";
                 }
                 else
                 {
                     txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                 }
                 gbParametrosBusqueda.Enabled = false;
             }
             else if (rbDivorcioAccidente.Checked == true)
             {
                 // divorcios accidente
                 cleanInputs();
                 pBaseObjfactura = facturacion.getDivorciosAccidentesStatus(ID);
                 pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                 pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                 txtBalanceTotal.Text = pBaseObjfactura.TotalPago_Mensualidad;
                 if (Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                 {
                     rbPasaporte.Checked = true;
                 }
                 else
                 {
                     rbCedula.Checked = true;
                 }
                 txtCedula.Text = pCliente.Cedula;
                 txtImpSobreRenta.Text = "Incluido";
                 txtITEBIS.Text = "Incluido";
                 txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                 txtServicio.Text = pService.Servicio;
                 txtTotalaPagar.Text = pBaseObjfactura.TotalPago_Mensualidad;
                 if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                 {
                     txtUltimoPago.Text = "No se ha hecho un pago aun";
                 }
                 else
                 {
                     txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                 }
                 gbParametrosBusqueda.Enabled = false;
             }
             else
             {
                 // general is selected.
                 if(Servicio == "Alquiler")
                 {
                     // alquiler
                     cleanInputs();
                     pBaseObjfactura = facturacion.getRentStatus(ID);
                     pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                     pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                     dbMensualidad.Checked = true;
                     gbPagoRealizar.Visible = true;
                     if (Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                     {
                         rbPasaporte.Checked = true;
                     }
                     else
                     {
                         rbCedula.Checked = true;
                     }
                     txtCedula.Text = pCliente.Cedula;
                     txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                     txtServicio.Text = pService.Servicio;
                     pbCedula.Image = Image.FromFile(pCliente.Image);
                     if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                     {
                         txtUltimoPago.Text = "No se ha hecho un pago aun";
                     }
                     else
                     {
                         txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                     }
                     rbAlquiler.Checked = true;
                     gbParametrosBusqueda.Enabled = false;
                 }
                 else if(Servicio == "Divorcio o Accidente")
                 {
                     // Divorcio accidente.
                     cleanInputs();
                     pBaseObjfactura = facturacion.getDivorciosAccidentesStatus(ID);
                     pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                     pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                     txtBalanceTotal.Text = pBaseObjfactura.TotalPago_Mensualidad;
                     if (Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                     {
                         rbPasaporte.Checked = true;
                     }
                     else
                     {
                         rbCedula.Checked = true;
                     }
                     txtCedula.Text = pCliente.Cedula;
                     txtImpSobreRenta.Text = "Incluido";
                     txtITEBIS.Text = "Incluido";
                     txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                     txtServicio.Text = pService.Servicio;
                     txtTotalaPagar.Text = pBaseObjfactura.TotalPago_Mensualidad;
                     if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                     {
                         txtUltimoPago.Text = "No se ha hecho un pago aun";
                     }
                     else
                     {
                         txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                     }
                     rbDivorcioAccidente.Checked = true;
                     gbParametrosBusqueda.Enabled = false;
                 }
                 else if (Servicio == "Ventas de Inmuebles")
                 {
                     // venta
                     cleanInputs();
                     pBaseObjfactura = facturacion.getVentasStatus(ID);
                     pCliente = clientes.getCustomerObject(pBaseObjfactura.Cliente_ID, "");
                     pService = servicios.getServiceInfo(pBaseObjfactura.Service_ID);
                     txtBalanceTotal.Text = pBaseObjfactura.TotalPago_Mensualidad;
                     if (Convert.ToInt32(clientes.verifyDocument(pCliente.ID, "")) > 0)
                     {
                         rbPasaporte.Checked = true;
                     }
                     else
                     {
                         rbCedula.Checked = true;
                     }
                     txtCedula.Text = pCliente.Cedula;
                     txtImpSobreRenta.Text = "Incluido";
                     txtITEBIS.Text = "Incluido";
                     txtNumeroCaso.Text = pBaseObjfactura.Case_ID;
                     txtServicio.Text = pService.Servicio;
                     txtTotalaPagar.Text = pBaseObjfactura.TotalPago_Mensualidad;
                     if (pBaseObjfactura.fechaUltimoPago == string.Empty || pBaseObjfactura.fechaUltimoPago == null)
                     {
                         txtUltimoPago.Text = "No se ha hecho un pago aun";
                     }
                     else
                     {
                         txtUltimoPago.Text = Convert.ToDateTime(pBaseObjfactura.fechaUltimoPago).ToLongDateString();
                     }
                     rbVentas.Checked = true;
                     gbParametrosBusqueda.Enabled = false;
                 }
             }
         }
         catch(Exception ex)
         {
             MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("No se ha seleccionado un caso de la tabla", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Esempio n. 3
0
 public static facturacionBaseObj getVentasStatus(string ID)
 {
     facturacionBaseObj pfactura = new facturacionBaseObj();
     using(SqlConnection con = DBcomun.getConnection())
     {
         SqlCommand comand = new SqlCommand(string.Format("SELECT * FROM ventaFacturacion WHERE ID = '{0}'", ID), con);
         SqlDataReader re = comand.ExecuteReader();
         if (re.HasRows)
         {
             while (re.Read())
             {
                 pfactura.ID = re["ID"].ToString();
                 pfactura.Cliente_ID = re["clienteID"].ToString();
                 pfactura.Service_ID = re["serviceID"].ToString();
                 pfactura.Case_ID = re["caseID"].ToString();
                 pfactura.TotalPago_Mensualidad = Convert.ToDouble(re["TotalPago"]).ToString("f2");
                 pfactura.Abono_Deposito = Convert.ToDouble(re["Abono"]).ToString("f2");
                 pfactura.fechaUltimoPago = re["ultimoPago"].ToString();
             }
         }
         else
         {
             pfactura = null;
         }
         con.Close();
     }
     return pfactura;
 }