Esempio n. 1
0
        public ActionResult AgregarFactura()
        {
            clsFactura            objFactura      = new clsFactura();
            clsServicioOtro       objServicioOtro = new clsServicioOtro();
            List <SelectListItem> items           = new List <SelectListItem>();

            try
            {
                if (Session["login"] != null)
                {
                    lstSuministro = objServicioOtro.ConsultarSuministro();
                    foreach (clsSuministro objSuministro in lstSuministro)
                    {
                        items.Add(new SelectListItem
                        {
                            Text  = objSuministro.numeroSuministro,
                            Value = objSuministro.idSuministro.ToString()
                        });
                    }
                    ViewBag.lstSuministro = items;

                    return(View(objFactura));
                }
                else
                {
                    return(RedirectToAction("Login", "Home"));
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Esempio n. 2
0
        public List <clsFactura> ConsultarFactura()
        {
            List <clsFactura>      lstFacturas            = new List <clsFactura>();
            DataTable              dtRespuesta            = null;
            clsPersistenciaFactura objPersistenciaFactura = new clsPersistenciaFactura();

            try
            {
                dtRespuesta = objPersistenciaFactura.ConsultarFactura("ServiciosBasicos");
                if (dtRespuesta != null)
                {
                    foreach (DataRow dr in dtRespuesta.Rows)
                    {
                        clsFactura objFactura = new clsFactura();
                        objFactura.idFactura        = int.Parse(dr[0].ToString());
                        objFactura.numeroSuministro = dr[1].ToString();
                        objFactura.valorFactura     = double.Parse(dr[2].ToString());
                        DateTime fecha = DateTime.Parse(dr[3].ToString());
                        objFactura.fechaEmision = fecha.ToString("yyyy-MM-dd");
                        fecha = DateTime.Parse(dr[4].ToString());
                        objFactura.fechaVencimiento = fecha.ToString("yyyy-MM-dd");
                        objFactura.valorPendiente   = double.Parse(dr[5].ToString());
                        objFactura.valorPagado      = bool.Parse(dr[6].ToString());
                        lstFacturas.Add(objFactura);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lstFacturas);
        }
Esempio n. 3
0
        private void cargarDgv()
        {
            clsPaquete aux = new clsPaquete();

            aux = p1.retornarPaquete(codigo);
            clsFactura fac = new clsFactura();

            fac = f1.recuperarFac(codigo);
            if (aux != null && fac != null)
            {
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Nombre Cliente"].Value = fac.Nombrecliente;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["DNI"].Value            = fac.Dnicliente;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Fecha Envio"].Value    = fac.Fechaenvio;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Empresa"].Value        = fac.Empresa;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Destino"].Value        = aux.Ciudad;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Direccion"].Value      = aux.Direccion;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["Estado"].Value         = aux.Estado;
                dgvMostrar.Rows[dgvMostrar.Rows.Count - 1].Cells["fechallegada"].Value   = fac.Fechallegada;
            }

            else
            {
                MessageBox.Show("Codigo invalido, verifique los datos");
            }
        }
Esempio n. 4
0
 private void txtDocRef_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F1)
     {
         if (Application.OpenForms["frmListaFacturasPorProveedor"] != null)
         {
             Application.OpenForms["frmListaFacturasPorProveedor"].Activate();
         }
         else
         {
             frmListaFacturasPorProveedor form = new frmListaFacturasPorProveedor();
             form.CodProveedor = CodProveedor;
             form.tipo         = 2;
             form.ShowDialog();
             if (form.factura != null && form.factura.CodFactura != 0)
             {
                 factur = form.factura; CodFactura = Convert.ToInt32(factur.CodFactura);
             }
             else
             {
             }
             if (CodFactura != 0)
             {
                 CargaFacturaGrid(); txtComentario.Focus();
             }
         }
     }
 }
Esempio n. 5
0
        private void frmMenuEmpresa_Load(object sender, EventArgs e)
        {
            clsFactura b = new clsFactura();

            dgvEnviosRecibidos.DataSource = null;
            lista = new List <clsFactura>();
            lista = b.traerFacturas(nombre);
            if (lista != null)
            {
                dgvEnviosRecibidos.DataSource = lista;
            }

            dt.Visible = false;
            List <clsSucursal> listasucursal = new List <clsSucursal>();
            clsSucursal        a             = new clsSucursal();

            foreach (clsSucursal s in a.Leer())
            {
                listasucursal.Add(s);
            }

            dgvSucursal.DataSource = listasucursal;

            dtpFiltroFechaEnvioDesde.Enabled = ckbFiltroFechaEnvioDesde.Checked;
            dtpFiltroFechaEnvioHasta.Enabled = ckbFiltroFechaEnvioHasta.Checked;
        }
Esempio n. 6
0
 public void agregarRegistro(clsFactura obj)
 {
     if (EscribirRegistro(this.nregs, obj))
     {
         this.nregs++;
     }
 }
Esempio n. 7
0
        public clsFactura CargaFactura(Int32 CodFactura)
        {
            clsFactura factura = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("MuestraFactura", con.conector);
                cmd.Parameters.AddWithValue("codfactura", CodFactura);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        factura                        = new clsFactura();
                        factura.CodFactura             = dr.GetInt32(0);
                        factura.CodNotaIngreso         = dr.GetInt32(1);
                        factura.CodTipoTransaccion     = dr.GetInt32(2);
                        factura.SiglaTransaccion       = dr.GetString(3);
                        factura.DescripcionTransaccion = dr.GetString(4);
                        factura.CodTipoDocumento       = Convert.ToInt32(dr.GetString(5));
                        factura.SiglaDocumento         = dr.GetString(6);
                        factura.DocumentoFactura       = dr.GetString(7);
                        factura.Moneda                 = Convert.ToInt32(dr.GetString(8));
                        factura.TipoCambio             = dr.GetDouble(9);
                        factura.FechaIngreso           = dr.GetDateTime(10);
                        factura.Comentario             = dr.GetString(11);
                        factura.MontoBruto             = dr.GetDouble(12);
                        factura.MontoDscto             = dr.GetDouble(13);
                        factura.Igv                    = dr.GetDouble(14);
                        factura.Total                  = dr.GetDouble(15);
                        factura.Abonado                = dr.GetDouble(16);
                        factura.Pendiente              = dr.GetDouble(17);
                        factura.Estado                 = dr.GetInt32(18);
                        factura.Recibido               = dr.GetInt32(19);
                        factura.FormaPago              = dr.GetInt32(20);
                        factura.FechaPago              = dr.GetDateTime(21);
                        factura.Cancelado              = dr.GetInt32(22);
                        factura.CodUser                = dr.GetInt32(23);
                        factura.FechaRegistro          = dr.GetDateTime(24);
                        factura.Flete                  = dr.GetDouble(25);
                        factura.CodProveedor           = dr.GetInt32(26);
                        factura.RazonSocialProveedor   = dr.GetString(27);
                        factura.RUCProveedor           = dr.GetString(28);
                        factura.Motivo                 = dr.GetString(29);
                        factura.CodSerie               = dr.GetInt32(30);
                    }
                }
                return(factura);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Esempio n. 8
0
    protected void Unnamed14_Click(object sender, EventArgs e)
    {
        lista.abrirFichero(Server.MapPath(@"~/Archivos/Facturas.bin"));
        clsFactura obj = new clsFactura(1, Convert.ToDateTime(FechaEmi.Text), Convert.ToDateTime(FechaCobro.Text), "Propia", ComboModo.Text, 1, 1, 1);

        lista.agregarRegistro(obj);
        Notas.Text = Convert.ToString(lista.Registro);
        lista.CerrarFichero();
    }
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            Int32  NroFactura, Servicios, Vendedor, Cantidad, ValorUnitario, DocumentoPropietario;
            string Nombre;


            if (lblNroFactura.Text == "")
            {
                lblNroFactura.Text = "0";
            }

            NroFactura           = Convert.ToInt32(lblNroFactura.Text);
            Vendedor             = Convert.ToInt32(cboVendedor.SelectedValue);
            Cantidad             = Convert.ToInt32(txtCantidad.Text);
            ValorUnitario        = Convert.ToInt32(lblValor.Text);
            Servicios            = Convert.ToInt32(cboServicios.SelectedValue);
            DocumentoPropietario = Convert.ToInt32(txtCedulaPro.Text);
            Nombre = cboServicios.SelectedItem.ToString();

            clsFactura oFactura = new clsFactura();

            oFactura.Producto      = Servicios;
            oFactura.Vendedor      = Vendedor;
            oFactura.Nombre        = Nombre;
            oFactura.Cedula        = DocumentoPropietario;
            oFactura.NumeroFactura = NroFactura;
            oFactura.Cantidad      = Cantidad;
            oFactura.ValorUnitario = ValorUnitario;

            clsRN_TALLER_CARROS oRN = new clsRN_TALLER_CARROS();

            if (oFactura.Grabar())
            {
                txtCedulaPro.Enabled = false;
                cboVendedor.Enabled  = false;
                lblNroFactura.Text   = oFactura.NumeroFactura.ToString();
                lblTotal.Text        = "$ " + oFactura.Total.ToString("#,###");
                oRN.ValorServicios   = oFactura.Total;
                oRN.Calcular();
                double ejem = oRN.PorcentajeDescuento * 100;
                lblPD.Text      = "% " + ejem.ToString();
                lblValorTD.Text = "$ " + oRN.ValorTotal.ToString("#,###");
                lblVD.Text      = "$ " + oRN.ValorDescuento.ToString("#,###");
                LlenarGridFactura();
                //lblError.Text = "Grabó la factura";
            }
            else
            {
                lblError.Text = oFactura.Error;
            }
            oFactura = null;
            oRN      = null;
        }
Esempio n. 10
0
 public Boolean update(clsFactura factura)
 {
     try
     {
         return(Mfactura.update(factura));
     }
     catch (Exception ex)
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
 }
Esempio n. 11
0
 private void CargaCuentaxPagar()
 {
     notaI = Admfac.CargaFactura(Convert.ToInt32(notaI.CodFactura));
     txtCodCliente.Text         = notaI.RUCProveedor;
     txtNombreProveedor.Text    = notaI.RazonSocialProveedor;
     cmbFormaPago.SelectedValue = notaI.FormaPago;
     fpago                   = AdmPago.CargaFormaPago(Convert.ToInt32(cmbFormaPago.SelectedValue));
     txtMonto.Text           = String.Format("{0:#,##0.00}", notaI.Pendiente);
     cmbMoneda.SelectedValue = notaI.Moneda;
     txtTipoCambio.Text      = notaI.TipoCambio.ToString();
     //documento = notaI.DocumentoFactura;
 }
Esempio n. 12
0
        private void LlenarGridFactura()
        {
            Int32      NumeroFactura = Convert.ToInt32(lblNroFactura.Text);
            clsFactura oFactura      = new clsFactura();

            oFactura.NumeroFactura = NumeroFactura;
            oFactura.grdFactura    = grdFactura;
            if (!oFactura.LlenarGrid())
            {
                lblError.Text = oFactura.Error;
            }

            oFactura = null;
        }
Esempio n. 13
0
 public FrmAlquiler(clsDueño dueño, clsVehiculo vehs, clsLote lotes, clsTarifa tarf, clsAlquiler alq)
 {
     misDueños     = dueño;
     misVehiculos  = vehs;
     misLotes      = lotes;
     misTarifas    = tarf;
     misAlquileres = alq;
     misFacturas   = new clsFactura();
     miConversor   = new clsConversor(alq, vehs, tarf, dueño, lotes);
     InitializeComponent();
     dgvAlquileres.ReadOnly          = true;
     dgvAlquileres.RowHeadersVisible = false;
     dgvAlquileres.SelectionMode     = DataGridViewSelectionMode.FullRowSelect;
 }
Esempio n. 14
0
        public frmListadoFacturas(clsConexion cone, clsEntidadUsuario pEntidadUsuario, clsEntidadVista vista)
        {
            materialSkinManager = MaterialSkinManager.Instance;
            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE);

            this.clFactura = new clsFactura();
            this.factura   = new clsEntidadDetalleFactura();
            facturaE       = new clsEntidadFacturaEncabezado();
            this.conexion  = cone;
            usuario        = pEntidadUsuario;
            this.clVistas  = new clsVistas();

            InitializeComponent();
        }
Esempio n. 15
0
        private void FrmInicio_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;

            //CONSTRUIR ó BUSCAR archivos
            misDueños     = new clsDueño("Inquilinos", "C:\\Sistema de Cochera\\Inquilinos");
            misVehiculos  = new clsVehiculo("Vehiculos", "C:\\Sistema de Cochera\\Vehiculos");
            misTarifas    = new clsTarifa("Tarifas", "C:\\Sistema de Cochera\\Tarifas");
            misLotes      = new clsLote("Lotes", "C:\\Sistema de Cochera\\Lotes");
            misAlquileres = new clsAlquiler("Alquileres", "C:\\Sistema de Cochera\\Alquileres");
            misFacturas   = new clsFactura("Facturas", "C:\\Sistema de Cochera\\Facturas");
            //genera el conversor
            miConversor = new clsConversor(misAlquileres, misVehiculos, misTarifas, misDueños, misLotes);
            //configura grilla:
            setVistas();
        }
Esempio n. 16
0
        public Boolean update(clsFactura Factura)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("ActualizaFactura", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("codfactura", Factura.CodFactura);
                cmd.Parameters.AddWithValue("codtipo", Factura.CodTipoDocumento);
                cmd.Parameters.AddWithValue("numdoc", Factura.NumFac);
                cmd.Parameters.AddWithValue("moneda", Factura.Moneda);
                cmd.Parameters.AddWithValue("tipocambio", Factura.TipoCambio);
                cmd.Parameters.AddWithValue("fechaingreso", Factura.FechaIngreso);
                cmd.Parameters.AddWithValue("comentario", Factura.Comentario);
                cmd.Parameters.AddWithValue("bruto", Factura.MontoBruto);
                cmd.Parameters.AddWithValue("montodscto", Factura.MontoDscto);
                cmd.Parameters.AddWithValue("igv", Factura.Igv);
                cmd.Parameters.AddWithValue("flete", Factura.Flete);
                cmd.Parameters.AddWithValue("total", Factura.Total);
                cmd.Parameters.AddWithValue("estado", Factura.Estado);
                cmd.Parameters.AddWithValue("recibido", Factura.Recibido);
                cmd.Parameters.AddWithValue("formapago", Factura.FormaPago);
                cmd.Parameters.AddWithValue("fechapago", Factura.FechaPago);
                cmd.Parameters.AddWithValue("fechacancelado", Factura.FechaCancelado);
                cmd.Parameters.AddWithValue("cancelado", Factura.Cancelado);
                cmd.Parameters.AddWithValue("codpro", Factura.CodProveedor);
                cmd.Parameters.AddWithValue("codalma", Factura.CodAlmacen);
                int x = cmd.ExecuteNonQuery();
                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Esempio n. 17
0
        public ActionResult ModificarFactura(string idFactura)
        {
            clsServicioOtro       objServicioOtro = new clsServicioOtro();
            List <SelectListItem> items           = new List <SelectListItem>();

            try
            {
                if (Session["login"] != null)
                {
                }
                else
                {
                    return(RedirectToAction("Login", "Home"));
                }
                lstSuministro = objServicioOtro.ConsultarSuministro();
                foreach (clsSuministro objSuministro in lstSuministro)
                {
                    items.Add(new SelectListItem
                    {
                        Text  = objSuministro.numeroSuministro,
                        Value = objSuministro.idSuministro.ToString()
                    });
                }

                lstFactura = (List <clsFactura>)Session["lista"];
                clsFactura objFactura = lstFactura.Find(x => x.idFactura == int.Parse(idFactura));

                if (objFactura != null)
                {
                    ViewBag.lstSuministro = items;
                    return(View(objFactura));
                }
                else
                {
                    return(RedirectToAction("Error", "Home"));
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Esempio n. 18
0
        public Boolean insert(clsFactura factura)
        {
            try
            {
                return(Mfactura.insert(factura));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Duplicate entry"))
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(false);
            }
        }
Esempio n. 19
0
        private void btnMostrarInfo_Click(object sender, EventArgs e)
        {
            if (tbDniBuscar.Text != string.Empty)
            {
                clsFactura        mostrar = new clsFactura();
                List <clsFactura> lista   = new List <clsFactura>();
                lista = mostrar.recuperarFac(int.Parse(tbDniBuscar.Text));
                if (lista != null)
                {
                    dgvFacturas.DataSource = lista;
                }
                else
                {
                    MessageBox.Show("no se encontro la informacion");
                }
            }

            else
            {
                MessageBox.Show("Ingrese el dni");
            }
        }
Esempio n. 20
0
 private void CargaFacturaGrid()
 {
     try
     {
         factur = AdmFactura.CargaFactura(CodFactura);
         if (factur != null)
         {
             txtDocRef.Text          = factur.DocumentoFactura;
             txtTipoCambio.Text      = factur.TipoCambio.ToString();
             cmbMoneda.SelectedValue = factur.Moneda;
             CargaDetalleNota();
         }
         else
         {
             MessageBox.Show("El documento solicitado no existe", "Nota de Credito", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         return;
     }
 }
Esempio n. 21
0
 protected void Unnamed14_Click(object sender, EventArgs e)
 {
     ErrorMessage.Text = "";
     lista.abrirFichero(Server.MapPath(@"~/Archivos/facturas.bin"));
     if (ComboFactura.Items.IndexOf(ComboFactura.Items.FindByValue(ComboFactura.Text)).Equals(0))
     {
         ErrorMessage.Text = "Ingrese un tipo de factura correcto...";
     }
     else
     if (FechaEmi.Text != "" && FechaCobro.Text != "")
     {
         clsFactura obj = new clsFactura(1, Convert.ToDateTime(FechaEmi.Text), Convert.ToDateTime(FechaCobro.Text), "Propia", "Hola", 1, 1, 1);
         lista.agregarRegistro(obj);
         Notas.Text = Convert.ToString(lista.Registro);
         lista.CerrarFichero();
         SuccessMessage.Text = "Guardado con éxito...";
         ErrorMessage.Text   = "";
     }
     else
     {
         //ErrorMessage.Text = "Ingrese una Fecha de Emisión o Fecha de cobro válida...";
     }
     //}
 }
Esempio n. 22
0
        //private void CargaNotaSalidaND()
        //{
        //    try
        //    {
        //        notaS = AdmNotaS.CargaNotaSalida(CodNotaS);
        //        if (notaS != null)
        //        {
        //            txtDocRef.Text = factur.DocumentoFactura;
        //            cmbMoneda.SelectedValue = notaS.Moneda;
        //            txtTipoCambio.Text = factur.TipoCambio.ToString();
        //            CargaDetalleNota();
        //        }
        //        else
        //        {
        //            MessageBox.Show("El documento solicitado no existe", "Nota de Credito", MessageBoxButtons.OK, MessageBoxIcon.Information);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        return;
        //    }
        //}

        private void CargaNotaSalida()
        {
            try
            {
                factur = AdmFact.CargaFactura(CodNotaS);
                if (factur != null)
                {
                    txtTransaccion.Text    = factur.SiglaTransaccion;
                    cmbMotivo.SelectedItem = factur.Motivo;
                    if (cmbMotivo.SelectedIndex == -1)
                    {
                        cmbMotivo.SelectedItem = "Otros";
                        lblOtros.Visible       = true;
                        txtOtros.Visible       = true;
                        txtOtros.Text          = factur.Motivo;
                    }
                    String[] A = factur.DocumentoFactura.Split('-');
                    txtCodProveedor.Text    = factur.RUCProveedor;
                    txtNombreProveedor.Text = factur.RazonSocialProveedor;
                    txtComentario.Text      = factur.Comentario;
                    txtDocRef.Text          = DocRef;
                    cmbMoneda.SelectedValue = factur.Moneda;
                    dtpFecha.Value          = factur.FechaIngreso;
                    txtTipoCambio.Text      = factur.TipoCambio.ToString();
                    CargaDetalleNotaS();
                }
                else
                {
                    MessageBox.Show("El documento solicitado no existe", "Nota de Credito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                return;
            }
        }
Esempio n. 23
0
        private void btnTransferir_Click(object sender, EventArgs e)
        {
            clsFactura fac = new clsFactura();

            fac.Id            = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["id"].Value.ToString());
            fac.Nombrecliente = dgvEnviosRecibidos.CurrentRow.Cells["nombrecliente"].Value.ToString();
            fac.CodigoPaquete = dgvEnviosRecibidos.CurrentRow.Cells["codigoPaquete"].Value.ToString();
            fac.Dnicliente    = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["dnicliente"].Value.ToString());
            fac.Empresa       = dgvEnviosRecibidos.CurrentRow.Cells["empresa"].Value.ToString();
            fac.Fechaenvio    = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechaenvio"].Value.ToString());
            fac.Fechallegada  = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechallegada"].Value.ToString());
            fac.Postal        = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["Postal"].Value.ToString());
            fac.Precio        = float.Parse(dgvEnviosRecibidos.CurrentRow.Cells["precio"].Value.ToString());
            if (dgvSucursal.SelectedRows.Count != 0)
            {
                if (fac.Postal == int.Parse(dgvSucursal.CurrentRow.Cells["codigoPostal"].Value.ToString()))
                {
                    List <clsFactura> listafact = new List <clsFactura>();
                    clsFactura        f         = new clsFactura();

                    foreach (clsFactura facturita in f.Leer())
                    {
                        if (facturita.Id == fac.Id)
                        {
                            facturita.Id            = fac.Id;
                            facturita.CodigoPaquete = fac.CodigoPaquete;
                            facturita.Dnicliente    = fac.Dnicliente;
                            facturita.Empresa       = dgvSucursal.CurrentRow.Cells["nombre"].Value.ToString();
                            facturita.Fechaenvio    = fac.Fechaenvio;
                            facturita.Fechallegada  = dt.Value;
                            facturita.Postal        = fac.Postal;
                            facturita.Precio        = fac.Precio;
                            facturita.Nombrecliente = fac.Nombrecliente;

                            listafact.Add(facturita);
                        }
                        else
                        {
                            listafact.Add(facturita);
                        }
                    }
                    List <clsPaquete> lista1  = new List <clsPaquete>();
                    clsPaquete        cambiar = new clsPaquete();
                    cambiar = cambiar.retornarPaquete(fac.CodigoPaquete);

                    clsPaquete p2 = new clsPaquete();
                    if (cambiar.Estado == "Despachado")
                    {
                        foreach (clsPaquete g in p2.Leer())
                        {
                            if (g.Id == cambiar.Id)
                            {
                                g.NombreDestinatario = cambiar.NombreDestinatario;
                                g.DniDestinatario    = cambiar.DniDestinatario;
                                g.Ciudad             = cambiar.Ciudad;
                                g.Direccion          = cambiar.Direccion;
                                g.Id     = cambiar.Id;
                                g.Codigo = cambiar.Codigo;
                                g.Kilos  = cambiar.Kilos;
                                g.Estado = "El paquete fue tranferido a la sucursal:" + dgvSucursal.CurrentRow.Cells["nombre"].Value.ToString();
                                lista1.Add(g);
                            }
                            else
                            {
                                lista1.Add(g);
                            }
                        }
                    }
                    clsPaquete modi = new clsPaquete();
                    string     res  = string.Empty;
                    res = modi.ModificarPaq(lista1);
                    clsFactura m      = new clsFactura();
                    string     resFac = string.Empty;
                    resFac = m.ModificarFac(listafact);



                    if (resFac == string.Empty && res == string.Empty)
                    {
                        MessageBox.Show("El paquete fue transferido");
                    }

                    else
                    {
                        MessageBox.Show("error");
                    }
                }
                else
                {
                    MessageBox.Show("No coinciden el codigo postal de la sucursal con el del paquete por favor verifique bien");
                }
            }
            else
            {
                MessageBox.Show("Seleccione una sucursal");
            }
        }
Esempio n. 24
0
        private void btnRegistrarEncomienda_Click(object sender, EventArgs e)
        {
            if (tbCodpaquete.Text != string.Empty && tbdnicliente.Text != string.Empty && cbempresas.SelectedItem != null)
            {
                clsEmpresa verifica   = new clsEmpresa();
                bool       encontrado = verifica.existeCodigoPostal(cbempresas.SelectedItem.ToString(), int.Parse(tbCodPostal.Text));
                if (encontrado == true)
                {
                    clsFactura nuevo = new clsFactura();
                    nuevo.Id            = nuevo.RecuperarUltimoId() + 1;
                    nuevo.CodigoPaquete = tbCodpaquete.Text;
                    nuevo.Nombrecliente = tbnomcliente.Text;
                    nuevo.Dnicliente    = int.Parse(tbdnicliente.Text);
                    nuevo.Precio        = float.Parse(tbPrecio.Text);
                    nuevo.Fechallegada  = dtpfecha.Value;
                    nuevo.Fechaenvio    = dtOculto.Value;
                    nuevo.Empresa       = cbempresas.SelectedItem.ToString();
                    nuevo.Postal        = int.Parse(tbCodPostal.Text);
                    List <clsPaquete> lista1  = new List <clsPaquete>();
                    clsPaquete        cambiar = new clsPaquete();
                    cambiar = cambiar.retornarPaquete(nuevo.CodigoPaquete);
                    clsPaquete modi = new clsPaquete();
                    if (cambiar.Estado == "Despachado")
                    {
                        MessageBox.Show("Este paquete ya fue enviado");
                    }

                    else
                    {
                        clsPaquete p2 = new clsPaquete();

                        foreach (clsPaquete g in p2.Leer())
                        {
                            if (g.Id == cambiar.Id)
                            {
                                g.NombreDestinatario = cambiar.NombreDestinatario;
                                g.DniDestinatario    = cambiar.DniDestinatario;
                                g.Ciudad             = cambiar.Ciudad;
                                g.Direccion          = cambiar.Direccion;
                                g.Id     = cambiar.Id;
                                g.Codigo = cambiar.Codigo;
                                g.Kilos  = cambiar.Kilos;
                                g.Estado = "Despachado";
                                lista1.Add(g);
                            }
                            else
                            {
                                lista1.Add(g);
                            }
                        }



                        string res2 = string.Empty;
                        res2 = modi.ModificarPaq(lista1);
                        string res = string.Empty;
                        res = nuevo.Grabar();
                        if (res == string.Empty)
                        {
                            MessageBox.Show("encomienda enviada");
                        }

                        else
                        {
                            MessageBox.Show("ocurrio el siguiente error" + res);
                        }

                        tbCodpaquete.Clear();
                        tbdnicliente.Clear();
                        tbnomcliente.Clear();
                        tbPrecio.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("No coincide el codigo postal del paquete con el de la empresa y sus sucursales, por favor verifique bien");
                }
            }
            else if (tbCodpaquete.Text != string.Empty && tbdnicliente.Text == string.Empty && tbCodPostal.Text == string.Empty)
            {
                MessageBox.Show("Seleccione el cliente");
            }
            else
            {
                MessageBox.Show("Seleccione el paquete a enviar  ");
            }
        }
Esempio n. 25
0
        private void btnRecibido_Click(object sender, EventArgs e)
        {
            clsSucursal suc = new clsSucursal();
            clsSucursal aux = new clsSucursal();

            suc = aux.traerSucursal(nombre);
            if (dgvEnviosRecibidos.SelectedRows.Count != 0)
            {
                clsFactura fac = new clsFactura();

                fac.Id            = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["id"].Value.ToString());
                fac.Nombrecliente = dgvEnviosRecibidos.CurrentRow.Cells["nombrecliente"].Value.ToString();
                fac.CodigoPaquete = dgvEnviosRecibidos.CurrentRow.Cells["codigoPaquete"].Value.ToString();
                fac.Dnicliente    = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["dnicliente"].Value.ToString());
                fac.Empresa       = dgvEnviosRecibidos.CurrentRow.Cells["empresa"].Value.ToString();
                fac.Fechaenvio    = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechaenvio"].Value.ToString());
                fac.Fechallegada  = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechallegada"].Value.ToString());
                fac.Postal        = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["Postal"].Value.ToString());
                fac.Precio        = float.Parse(dgvEnviosRecibidos.CurrentRow.Cells["precio"].Value.ToString());


                List <clsPaquete> lista1  = new List <clsPaquete>();
                clsPaquete        cambiar = new clsPaquete();
                cambiar = cambiar.retornarPaquete(fac.CodigoPaquete);

                clsPaquete p2 = new clsPaquete();
                if (cambiar.Estado == "Despachado")
                {
                    foreach (clsPaquete g in p2.Leer())
                    {
                        if (g.Id == cambiar.Id)
                        {
                            g.NombreDestinatario = cambiar.NombreDestinatario;
                            g.DniDestinatario    = cambiar.DniDestinatario;
                            g.Ciudad             = cambiar.Ciudad;
                            g.Direccion          = cambiar.Direccion;
                            g.Id     = cambiar.Id;
                            g.Codigo = cambiar.Codigo;
                            g.Kilos  = cambiar.Kilos;
                            g.Estado = "El paquete se encuentra en la central de:" + suc.Nombre + " en " + suc.LocalidadUbicacion + " ubicada en: " + suc.Direccion + " y pronto se hara la entrega";
                            lista1.Add(g);
                        }
                        else
                        {
                            lista1.Add(g);
                        }
                    }

                    clsPaquete modi = new clsPaquete();
                    string     res  = string.Empty;
                    res = modi.ModificarPaq(lista1);

                    List <clsFactura> listafact = new List <clsFactura>();
                    clsFactura        f         = new clsFactura();

                    foreach (clsFactura facturita in f.Leer())
                    {
                        if (facturita.Id == fac.Id)
                        {
                            facturita.Id            = fac.Id;
                            facturita.CodigoPaquete = fac.CodigoPaquete;
                            facturita.Dnicliente    = fac.Dnicliente;
                            facturita.Empresa       = suc.Nombre;
                            facturita.Fechaenvio    = fac.Fechaenvio;
                            facturita.Fechallegada  = dt.Value;
                            facturita.Postal        = fac.Postal;
                            facturita.Precio        = fac.Precio;
                            facturita.Nombrecliente = fac.Nombrecliente;

                            listafact.Add(facturita);
                        }
                        else
                        {
                            listafact.Add(facturita);
                        }
                    }

                    clsFactura m      = new clsFactura();
                    string     resFac = string.Empty;
                    resFac = m.ModificarFac(listafact);

                    if (res == string.Empty && resFac == string.Empty)
                    {
                        MessageBox.Show("Operacion realizada");
                    }
                    else
                    {
                        MessageBox.Show("error:" + res + resFac);
                    }
                }
                else
                {
                    MessageBox.Show("Este paquete ya fue recibido");
                }
            }
            else
            {
                MessageBox.Show("seleccione el paquete");
            }
        }
Esempio n. 26
0
        private void btnDevolver_Click(object sender, EventArgs e)
        {
            clsFactura fac = new clsFactura();

            if (dgvEnviosRecibidos.SelectedRows.Count != 0)
            {
                fac.Id            = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["id"].Value.ToString());
                fac.Nombrecliente = dgvEnviosRecibidos.CurrentRow.Cells["nombrecliente"].Value.ToString();
                fac.CodigoPaquete = dgvEnviosRecibidos.CurrentRow.Cells["codigoPaquete"].Value.ToString();
                fac.Dnicliente    = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["dnicliente"].Value.ToString());
                fac.Empresa       = dgvEnviosRecibidos.CurrentRow.Cells["empresa"].Value.ToString();
                fac.Fechaenvio    = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechaenvio"].Value.ToString());
                fac.Fechallegada  = Convert.ToDateTime(dgvEnviosRecibidos.CurrentRow.Cells["fechallegada"].Value.ToString());
                fac.Postal        = int.Parse(dgvEnviosRecibidos.CurrentRow.Cells["Postal"].Value.ToString());
                fac.Precio        = float.Parse(dgvEnviosRecibidos.CurrentRow.Cells["precio"].Value.ToString());


                List <clsPaquete> lista1  = new List <clsPaquete>();
                clsPaquete        cambiar = new clsPaquete();
                cambiar = cambiar.retornarPaquete(fac.CodigoPaquete);

                clsPaquete p2 = new clsPaquete();
                if (cambiar.Estado == "Despachado")
                {
                    foreach (clsPaquete g in p2.Leer())
                    {
                        if (g.Id == cambiar.Id)
                        {
                            g.NombreDestinatario = cambiar.NombreDestinatario;
                            g.DniDestinatario    = cambiar.DniDestinatario;
                            g.Ciudad             = cambiar.Ciudad;
                            g.Direccion          = cambiar.Direccion;
                            g.Id     = cambiar.Id;
                            g.Codigo = cambiar.Codigo;
                            g.Kilos  = cambiar.Kilos;
                            g.Estado = "El paquete fue devuelto al local donde usted envio la encomienda,para mas informacion comuniquese al 0800456788";
                            lista1.Add(g);
                        }
                        else
                        {
                            lista1.Add(g);
                        }
                    }

                    clsPaquete modi = new clsPaquete();
                    string     res  = string.Empty;
                    res = modi.ModificarPaq(lista1);

                    List <clsFactura> listafact = new List <clsFactura>();
                    clsFactura        f         = new clsFactura();

                    foreach (clsFactura facturita in f.Leer())
                    {
                        if (facturita.Id == fac.Id)
                        {
                            facturita.Id            = fac.Id;
                            facturita.CodigoPaquete = fac.CodigoPaquete;
                            facturita.Dnicliente    = fac.Dnicliente;
                            facturita.Empresa       = fac.Empresa;
                            facturita.Fechaenvio    = fac.Fechaenvio;
                            facturita.Fechallegada  = dt.Value;
                            facturita.Postal        = fac.Postal;
                            facturita.Precio        = fac.Precio;
                            facturita.Nombrecliente = fac.Nombrecliente;

                            listafact.Add(facturita);
                        }
                        else
                        {
                            listafact.Add(facturita);
                        }
                    }

                    clsFactura m      = new clsFactura();
                    string     resFac = string.Empty;
                    resFac = m.ModificarFac(listafact);
                    if (res == string.Empty && resFac == string.Empty)
                    {
                        MessageBox.Show("los datos fueron actualizados");
                    }

                    else
                    {
                        MessageBox.Show("ocurrio el siguiente error:" + res + resFac);
                    }
                }
                else
                {
                    MessageBox.Show("No puede realizar esta operacion");
                }
            }
            else
            {
                MessageBox.Show("Seleccione la encomienda");
            }
        }
Esempio n. 27
0
        // #region Implementacion IFactura

        public Boolean insert(clsFactura Factura)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("GuardaFactura", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter oParam;
                oParam = cmd.Parameters.AddWithValue("docfactura", Factura.DocumentoFactura);
                oParam = cmd.Parameters.AddWithValue("codtran", Factura.CodTipoTransaccion);
                oParam = cmd.Parameters.AddWithValue("codtipo", Factura.CodTipoDocumento);
                oParam = cmd.Parameters.AddWithValue("numdoc", Factura.NumFac);
                oParam = cmd.Parameters.AddWithValue("moneda", Factura.Moneda);
                oParam = cmd.Parameters.AddWithValue("tipocambio", Factura.TipoCambio);
                oParam = cmd.Parameters.AddWithValue("fechaingreso", Factura.FechaIngreso);
                oParam = cmd.Parameters.AddWithValue("comentario", Factura.Comentario);
                oParam = cmd.Parameters.AddWithValue("bruto", Factura.MontoBruto);
                oParam = cmd.Parameters.AddWithValue("montodscto", Factura.MontoDscto);
                oParam = cmd.Parameters.AddWithValue("igv", Factura.Igv);
                oParam = cmd.Parameters.AddWithValue("flete", Factura.Flete);
                oParam = cmd.Parameters.AddWithValue("total", Factura.Total);
                oParam = cmd.Parameters.AddWithValue("pendiente", Factura.Total);
                oParam = cmd.Parameters.AddWithValue("estado", Factura.Estado);
                oParam = cmd.Parameters.AddWithValue("recibido", Factura.Recibido);
                if (Factura.FormaPago != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("formapago", Factura.FormaPago);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("formapago", null);
                }
                oParam = cmd.Parameters.AddWithValue("fechapago", Factura.FechaPago);
                oParam = cmd.Parameters.AddWithValue("fechacancelado", Factura.FechaCancelado);
                oParam = cmd.Parameters.AddWithValue("cancelado", Factura.Cancelado);
                oParam = cmd.Parameters.AddWithValue("codusu", Factura.CodUser);
                oParam = cmd.Parameters.AddWithValue("codref", Factura.CodReferencia);
                oParam = cmd.Parameters.AddWithValue("codser", Factura.CodSerie);
                oParam = cmd.Parameters.AddWithValue("serie", Factura.Serie);
                oParam = cmd.Parameters.AddWithValue("codpro", Factura.CodProveedor);
                oParam = cmd.Parameters.AddWithValue("codalma", Factura.CodAlmacen);
                if (Factura.Motivo != "")
                {
                    cmd.Parameters.AddWithValue("motiv", Factura.Motivo);
                }
                else
                {
                    cmd.Parameters.AddWithValue("motiv", null);
                }
                oParam           = cmd.Parameters.AddWithValue("codNotaI_ex", Factura.CodNotaIngreso);
                oParam           = cmd.Parameters.AddWithValue("newid", 0);
                oParam.Direction = ParameterDirection.Output;
                int x = cmd.ExecuteNonQuery();

                Factura.CodFacturaNueva = Convert.ToInt32(cmd.Parameters["newid"].Value);

                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }