Ejemplo n.º 1
0
        public void loadSync(object element)
        {
            if (element != null)
            {
                RECIBO poco = (RECIBO)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.RECIBOes
                                 where poco.UNID_RECIBO == cust.UNID_RECIBO
                                 select cust).ToList();

                    //Actualización
                    if (query.Count > 0)
                    {
                        var aux = query.First();

                        if (aux.LAST_MODIFIED_DATE < poco.LAST_MODIFIED_DATE)
                        {
                            udpateElementSync((object)poco);
                        }
                    }
                    //Inserción
                    else
                    {
                        insertElementSyn((object)poco);
                    }

                    var modifiedMenu = entity.RECIBOes.First(p => p.UNID_RECIBO == poco.UNID_RECIBO);
                    modifiedMenu.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
Ejemplo n.º 2
0
        public void udpateElementSync(object element)
        {
            if (element != null && (element as RECIBO) != null)
            {
                RECIBO recibo = element as RECIBO;
                using (var Entity = new TAE2Entities())
                {
                    RECIBO r = Entity.RECIBOes.FirstOrDefault(o => o.UNID_RECIBO == recibo.UNID_RECIBO);
                    if (r != null)
                    {
                        r.UNID_SOLICITANTE = recibo.UNID_SOLICITANTE;
                        r.PO        = recibo.PO;
                        r.IS_ACTIVE = recibo.IS_ACTIVE;
                        //Sync
                        r.IS_MODIFIED        = true;
                        r.IS_ACTIVE          = true;
                        r.LAST_MODIFIED_DATE = UNID.getNewUNID();
                        var modifiedSync = Entity.SYNCs.FirstOrDefault(p => p.UNID_SYNC == 20120101000000000);
                        if (modifiedSync != null)
                        {
                            modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                        }

                        //
                        Entity.SaveChanges();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void generarRecibo()
 {
     try
     {
         myRecibo = liquidarCuota();
         if (myRecibo != null && myRecibo.ID > 0 && myRecibo.ARCHIVO_FISICO != null && myRecibo.ARCHIVO_FISICO.Length > 0)
         {
             String fileName = "CopiaRecibo_No." + myRecibo.NUMERO_RECIBO + "_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss.F") + ".pdf";
             fileName = fileName.Replace('/', '-');
             fileName = fileName.Replace(' ', '_');
             String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Recibos";
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             path += "\\" + fileName;
             File.WriteAllBytes(path, myRecibo.ARCHIVO_FISICO);
             Process.Start(path);
             int idCuota = int.Parse(grdCuotas.SelectedRows[0].Cells["ID"].Value.ToString());
             ACUERDO_PAGO_DETALLE detalle = new ACUERDO_PAGO_DETALLE();
             detalle.ID = idCuota;
             detalle    = serviciosACUERDO_PAGO_DETALLE.buscarPrimeroACUERDO_PAGO_DETALLE(detalle);
             if (detalle != null && detalle.ID > 0)
             {
                 detalle.ID_RECIBO = myRecibo.ID;
                 serviciosACUERDO_PAGO_DETALLE.editarACUERDO_PAGO_DETALLE(detalle);
                 getCuotas();
             }
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show("Se presentó el siguiente error: " + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
        /**
         * Busca los registros que coincidan con los datos enviados
         * @param RECIBO obj
         * @return Retorna la lista de los registros que coinciden
         */
        public RECIBO[] buscarRECIBO(RECIBO obj)
        {
            RECIBO[]      result = null;
            List <RECIBO> lista  = null;

            try
            {
                RECIBODao dao = new RECIBODao();
                conn  = conexion.conection();
                lista = dao.search(conn, obj);
                if (lista != null && lista.Count > 0)
                {
                    result = lista.ToArray();
                }
            }
            catch (Exception e)
            {
                result = null;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
        /**
         * Inserta nuevo registro en la tabla
         * @param RECIBO obj
         * @return Retorna el mismo objeto pero con la llave primaria configurada
         */
        public RECIBO crearRECIBO(RECIBO obj)
        {
            List <RECIBO> lista = null;

            try
            {
                RECIBODao dao = new RECIBODao();
                conn = conexion.conection();
                dao.create(conn, obj);
                //verificar existencia
                lista = dao.search(conn, obj);
                if (lista != null && lista.Count > 0)
                {
                    obj = (RECIBO)lista[0];
                }
                else
                {
                    obj.ID = -1;
                }
            }
            catch (Exception e)
            {
                obj.ID = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(obj);
        }
Ejemplo n.º 6
0
        public void delete(SqlConnection conn, RECIBO valueObject)
        {
            SqlCommand stmt = null;
            String     sql  = "";

            try
            {
                sql  = "DELETE FROM RECIBO WHERE ( id = @id )";
                stmt = new SqlCommand(sql, conn);
                stmt.Parameters.AddWithValue("@id", valueObject.ID);
                int rowcount = databaseUpdate(stmt);
                if (rowcount == 0)
                {
                    throw new Exception("Object could not be deleted! (PrimaryKey not found)");
                }
                if (rowcount > 1)
                {
                    throw new Exception("PrimaryKey Error when updating DB! (Many objects were deleted!)");
                }
            } finally {
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
        }
 private void anularReciboFactura()
 {
     if (grdDatos.SelectedRows != null && grdDatos.SelectedRows.Count > 0)
     {
         String numero;
         if (grdDatos.SelectedRows[0].Cells["num_factura"].Value != null && !String.IsNullOrEmpty(grdDatos.SelectedRows[0].Cells["num_factura"].Value.ToString()))
         {
             if (MessageBox.Show("¿Desea anular la factura No." + grdDatos.SelectedRows[0].Cells["num_factura"].Value.ToString() + "?", "¿Está seguro(a)?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 numero = grdDatos.SelectedRows[0].Cells["num_factura"].Value.ToString();
                 FACTURA factura = getFactura(numero);
                 if (factura != null && factura.ID > 0)
                 {
                     anularFactura(factura);
                 }
                 else
                 {
                     MessageBox.Show("La factura no fue encontrada", "Sin factura", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else //Se reimprime el recibo
             {
                 numero = grdDatos.SelectedRows[0].Cells["num_recibo"].Value.ToString();
                 RECIBO recibo = getRecibo(numero);
                 if (recibo != null && recibo.ID > 0)
                 {
                     if (MessageBox.Show("¿Desea anular el recibo No." + recibo.NUMERO_RECIBO + "?", "¿Está seguro(a)?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                     {
                         anularRecibo(recibo);
                     }
                 }
                 else
                 {
                     MessageBox.Show("El recibo no fue encontrado", "Sin recibo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             numero = grdDatos.SelectedRows[0].Cells["num_recibo"].Value.ToString();
             RECIBO recibo = getRecibo(numero);
             if (recibo != null && recibo.ID > 0)
             {
                 if (MessageBox.Show("¿Desea anular el recibo No." + recibo.NUMERO_RECIBO + "?", "Está seguro(a)?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     anularRecibo(recibo);
                 }
             }
             else
             {
                 MessageBox.Show("El recibo no fue encontrado", "Sin recibo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Debe seleccionar un registro de la lista", "Sin selección", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            RECIBO rECIBO = db.RECIBO.Find(id);

            db.RECIBO.Remove(rECIBO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 9
0
 public frmLiquidar()
 {
     InitializeComponent();
     serviciosTIPO_DOCUMENTO   = (ServiciosTIPO_DOCUMENTO)Configurador.ConfigurarServicio(typeof(ServiciosTIPO_DOCUMENTO));
     serviciosVIEW_CLIENTE     = (ServiciosVIEW_CLIENTE)Configurador.ConfigurarServicio(typeof(ServiciosVIEW_CLIENTE));
     serviciosTIPO_LIQUIDACION = (ServiciosTIPO_LIQUIDACION)Configurador.ConfigurarServicio(typeof(ServiciosTIPO_LIQUIDACION));
     serviciosLIQUIDACION      = (ServiciosLIQUIDACION)Configurador.ConfigurarServicio(typeof(ServiciosLIQUIDACION));
     getTiposDocumento();
     recibo = null;
 }
Ejemplo n.º 10
0
        public void GetFacturaListTest()
        {
            FacturaCompraDataMapper target = new FacturaCompraDataMapper(); // TODO: Inicializar en un valor adecuado
            RECIBO         recibo          = null;                          // TODO: Inicializar en un valor adecuado
            List <FACTURA> expected        = null;                          // TODO: Inicializar en un valor adecuado
            List <FACTURA> actual;

            actual = target.GetFacturaList(new RECIBO()
            {
                UNID_RECIBO = 20121203012919716
            });
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
 private RECIBO getRecibo(string numero)
 {
     try
     {
         RECIBO recibo = new RECIBO();
         recibo.NUMERO_RECIBO = numero;
         recibo = serviciosRECIBO.buscarPrimeroRECIBO(recibo);
         return(recibo);
     }
     catch (Exception exp)
     {
         return(null);
     }
 }
        public void GetListMovimientoTest()
        {
            ReciboDataMapper target = new ReciboDataMapper(); // TODO: Inicializar en un valor adecuado
            RECIBO           recibo = new RECIBO()
            {
                UNID_RECIBO = 20121203022523751
            };                                // TODO: Inicializar en un valor adecuado
            List <MOVIMENTO> expected = null; // TODO: Inicializar en un valor adecuado
            List <MOVIMENTO> actual;

            actual = target.GetListMovimiento(recibo);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
Ejemplo n.º 13
0
        private List <RECIBO> listQuery(SqlCommand stmt)
        {
            List <RECIBO> searchResults = new List <RECIBO>();
            SqlDataReader reader        = null;

            try
            {
                int intt = 0; long longg = 0; double doublee = 0; float floatt = 0; DateTime datee; byte[] bytee;
                reader = stmt.ExecuteReader();
                while (reader.Read())
                {
                    RECIBO temp = createValueObject();

                    temp.ID                  = reader["ID"] != null && int.TryParse(reader["ID"].ToString(), out intt) ? intt : 0;
                    temp.ID_LIQUIDACION      = reader["ID_LIQUIDACION"] != null && int.TryParse(reader["ID_LIQUIDACION"].ToString(), out intt) ? intt : 0;
                    temp.ID_ESTADO           = reader["ID_ESTADO"] != null && int.TryParse(reader["ID_ESTADO"].ToString(), out intt) ? intt : 0;
                    temp.NUMERO_RECIBO       = reader["NUMERO_RECIBO"] != null ? reader["NUMERO_RECIBO"].ToString() : null;
                    temp.FECHA_RECIBO        = reader["FECHA_RECIBO"] != null && !String.IsNullOrEmpty(reader["FECHA_RECIBO"].ToString()) ? (DateTime)reader["FECHA_RECIBO"] : DateTime.MinValue;
                    temp.FECHA_REGISTRO_PAGO = reader["FECHA_REGISTRO_PAGO"] != null && !String.IsNullOrEmpty(reader["FECHA_REGISTRO_PAGO"].ToString()) ? (DateTime)reader["FECHA_REGISTRO_PAGO"] : DateTime.MinValue;
                    temp.FECHA_PAGO          = reader["FECHA_PAGO"] != null && !String.IsNullOrEmpty(reader["FECHA_PAGO"].ToString()) ? (DateTime)reader["FECHA_PAGO"] : DateTime.MinValue;
                    temp.VALOR               = reader["VALOR"] != null && float.TryParse(reader["VALOR"].ToString(), out floatt) ? floatt : 0;
                    temp.FECHA_VENCIMIENTO   = reader["FECHA_VENCIMIENTO"] != null && !String.IsNullOrEmpty(reader["FECHA_VENCIMIENTO"].ToString()) ? (DateTime)reader["FECHA_VENCIMIENTO"] : DateTime.MinValue;
                    temp.FECHA_ENTRAMITE     = reader["FECHA_ENTRAMITE"] != null && !String.IsNullOrEmpty(reader["FECHA_ENTRAMITE"].ToString()) ? (DateTime)reader["FECHA_ENTRAMITE"] : DateTime.MinValue;
                    temp.FECHA_ANULADO       = reader["FECHA_ANULADO"] != null && !String.IsNullOrEmpty(reader["FECHA_ANULADO"].ToString()) ? (DateTime)reader["FECHA_ANULADO"] : DateTime.MinValue;
                    temp.FECHA_PAGOANULADO   = reader["FECHA_PAGOANULADO"] != null && !String.IsNullOrEmpty(reader["FECHA_PAGOANULADO"].ToString()) ? (DateTime)reader["FECHA_PAGOANULADO"] : DateTime.MinValue;
                    temp.FECHA_PROCESADO     = reader["FECHA_PROCESADO"] != null && !String.IsNullOrEmpty(reader["FECHA_PROCESADO"].ToString()) ? (DateTime)reader["FECHA_PROCESADO"] : DateTime.MinValue;
                    try
                    {
                        temp.ARCHIVO_FISICO = reader["ARCHIVO_FISICO"] != null ? (byte[])reader["ARCHIVO_FISICO"] : null;
                    }
                    catch (Exception)
                    {
                        temp.ARCHIVO_FISICO = null;
                    }

                    searchResults.Add(temp);
                }
            }
            finally {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
            return(searchResults);
        }
Ejemplo n.º 14
0
 public frmAcuerdoPago(ACUERDO_PAGO acuerdo)
 {
     InitializeComponent();
     serviciosLIQUIDACION          = (ServiciosLIQUIDACION)Configurador.ConfigurarServicio(typeof(ServiciosLIQUIDACION));
     serviciosACUERDO_PAGO         = (ServiciosACUERDO_PAGO)Configurador.ConfigurarServicio(typeof(ServiciosACUERDO_PAGO));
     serviciosACUERDO_PAGO_DETALLE = (ServiciosACUERDO_PAGO_DETALLE)Configurador.ConfigurarServicio(typeof(ServiciosACUERDO_PAGO_DETALLE));
     serviciosACUERDO_ESTADO       = (ServiciosACUERDO_ESTADO)Configurador.ConfigurarServicio(typeof(ServiciosACUERDO_ESTADO));
     serviciosSQL              = (ServiciosSQL)Configurador.ConfigurarServicio(typeof(ServiciosSQL));
     serviciosVIEW_CLIENTE     = (ServiciosVIEW_CLIENTE)Configurador.ConfigurarServicio(typeof(ServiciosVIEW_CLIENTE));
     serviciosRECIBO           = (ServiciosRECIBO)Configurador.ConfigurarServicio(typeof(ServiciosRECIBO));
     serviciosTIPO_LIQUIDACION = (ServiciosTIPO_LIQUIDACION)Configurador.ConfigurarServicio(typeof(ServiciosTIPO_LIQUIDACION));
     myAcuerdo = acuerdo;
     myRecibo  = null;
     setInfo();
 }
Ejemplo n.º 15
0
        // GET: /RECIBOS/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            RECIBO rECIBO = db.RECIBO.Find(id);

            if (rECIBO == null)
            {
                return(HttpNotFound());
            }

            return(View(rECIBO));
        }
Ejemplo n.º 16
0
        public ActionResult Edit([Bind(Include =
                                           "RECIBO_ID,USUARIO_ID,CLIENTE_ID,FORMA_PAGO_ID,NRO_RECIBO,FECHA_EMISION,SUBTOTAL,TOTAL,ANULADO,CAUSA_ANULADO,DESCRIPCION,NRO_DOC_PAGO,SERIE_DOC_ID")]
                                 RECIBO rECIBO)
        {
            if (ModelState.IsValid)
            {
                db.Entry(rECIBO).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CLIENTE_ID    = new SelectList(db.CLIENTE, "CLIENTE_ID", "NOMBRE_CLTE", rECIBO.CLIENTE_ID);
            ViewBag.FORMA_PAGO_ID = new SelectList(db.FORMA_PAGO, "FORMA_PAGO_ID", "DESCRIPCION", rECIBO.FORMA_PAGO_ID);
            ViewBag.USUARIO_ID    = new SelectList(db.USUARIO, "USUARIO_ID", "NOMBRE_COMPLETO", rECIBO.USUARIO_ID);
            return(View(rECIBO));
        }
Ejemplo n.º 17
0
 private void pagarRecibo()
 {
     try
     {
         double   valorTmp = 0;
         double   valor    = recibo.VALOR;
         Pagos    pago;
         DateTime fechaPago = datFechaPago.Value;
         foreach (DataGridViewRow fila in grdFormaPago.Rows)
         {
             if (!fila.Cells["valor"].Value.ToString().Equals("0"))
             {
                 double diferencia;
                 pago              = new Pagos();
                 pago.FECHA_PAGO   = fechaPago;
                 pago.ID_RECIBO    = recibo.ID;
                 pago.ID_FORMAPAGO = int.Parse(fila.Cells["ID"].Value.ToString());
                 pago.VALOR        = double.Parse(fila.Cells["valor"].Value.ToString());
                 valorTmp         += pago.VALOR;
                 if (valorTmp > valor)
                 {
                     diferencia = valorTmp - valor;
                     pago.VALOR = pago.VALOR - diferencia;
                     serviciosPagos.crearPagos(pago);
                     break;
                 }
                 serviciosPagos.crearPagos(pago);
             }
         }
         recibo.ID_ESTADO = 2;
         myRecibo         = new RECIBO();
         myRecibo.ID      = recibo.ID;
         myRecibo         = serviciosRECIBO.buscarPrimeroRECIBO(myRecibo);
         if (myRecibo != null && myRecibo.ID > 0)
         {
             myRecibo.ID_ESTADO  = 2;
             myRecibo.FECHA_PAGO = fechaPago;
             serviciosRECIBO.editarRECIBO(myRecibo);
         }
         MessageBox.Show("Pago realizado correctamente", "Pago correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnPagar.Enabled = false;
     }
     catch (Exception exp)
     {
         MessageBox.Show("Se presento el siguiente error: " + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 18
0
 public void insertElementSyn(object element)
 {
     if (element != null && (element as RECIBO) != null)
     {
         using (var entity = new TAE2Entities())
         {
             RECIBO item = (RECIBO)element;
             //Sync
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             //
             entity.RECIBOes.AddObject(item);
             entity.SaveChanges();
         }
     }
 }
Ejemplo n.º 19
0
        // GET: /RECIBOS/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            RECIBO rECIBO = db.RECIBO.Find(id);

            if (rECIBO == null)
            {
                return(HttpNotFound());
            }

            ViewBag.CLIENTE_ID    = new SelectList(db.CLIENTE, "CLIENTE_ID", "NOMBRE_CLTE", rECIBO.CLIENTE_ID);
            ViewBag.FORMA_PAGO_ID = new SelectList(db.FORMA_PAGO, "FORMA_PAGO_ID", "DESCRIPCION", rECIBO.FORMA_PAGO_ID);
            ViewBag.USUARIO_ID    = new SelectList(db.USUARIO, "USUARIO_ID", "NOMBRE_COMPLETO", rECIBO.USUARIO_ID);
            return(View(rECIBO));
        }
Ejemplo n.º 20
0
        /**
         * Elimina un registro de la tabla
         * @param ACUERDO_PAGO obj
         * @return Retorna un boolean indicando si se realizo o no la operacion
         */
        public bool eliminarACUERDO_PAGO(ACUERDO_PAGO obj)
        {
            bool resultado;

            resultado = false;
            try
            {
                ACUERDO_PAGO_DETALLEManagement gestionDetalle = new ACUERDO_PAGO_DETALLEManagement();
                ACUERDO_PAGO_DETALLE           detalle        = new ACUERDO_PAGO_DETALLE();
                detalle.ID_ACUERDO_PAGO = obj.ID;
                ACUERDO_PAGO_DETALLE[] lstDetalles = gestionDetalle.buscarACUERDO_PAGO_DETALLE(detalle);
                if (lstDetalles != null && lstDetalles.Length > 0)
                {
                    RECIBOManagement gestionRecibo = new RECIBOManagement();

                    foreach (ACUERDO_PAGO_DETALLE item in lstDetalles)
                    {
                        RECIBO recibo = new RECIBO();
                        if (item.ID_RECIBO != null && item.ID_RECIBO > 0)
                        {
                            recibo.ID = item.ID_RECIBO;
                            gestionRecibo.eliminarRECIBO(recibo);
                        }
                        gestionDetalle.eliminarACUERDO_PAGO_DETALLE(item);
                    }
                }
                ACUERDO_PAGODao dao = new ACUERDO_PAGODao();
                conn = conexion.conection();
                dao.delete(conn, obj);
                resultado = true;
            }
            catch (Exception e)
            {
                resultado = false;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(resultado);
        }
 private static void reimprimirRecibo(RECIBO recibo)
 {
     if (recibo.ARCHIVO_FISICO != null && recibo.ARCHIVO_FISICO.Length > 0)
     {
         String fileName = "CopiaRecibo_No." + recibo.NUMERO_RECIBO + "_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss.F") + ".pdf";
         fileName = fileName.Replace('/', '-');
         fileName = fileName.Replace(' ', '_');
         String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Recibos\\Reimpresos";
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         path += "\\" + fileName;
         File.WriteAllBytes(path, recibo.ARCHIVO_FISICO);
         Process.Start(path);
     }
     else
     {
         MessageBox.Show("El recibo no tiene un archivo fisico para reimprimir", "Sin documento", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 22
0
        public void insertElement(object element, USUARIO u)
        {
            if (element != null && (element as RECIBO) != null)
            {
                using (var entity = new TAE2Entities())
                {
                    RECIBO item = (RECIBO)element;
                    //Sync
                    item.IS_MODIFIED        = true;
                    item.IS_ACTIVE          = true;
                    item.LAST_MODIFIED_DATE = UNID.getNewUNID();
                    var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                    modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                    entity.SaveChanges();
                    //
                    entity.RECIBOes.AddObject(item);
                    entity.SaveChanges();

                    UNID.Master(item, u, -1, "Inserción");
                }
            }
        }
Ejemplo n.º 23
0
 private void limpiarLiquidacion()
 {
     try
     {
         grdDatos.Rows.Clear();
         btnLiquidar.Enabled  = false;
         lblNumRecibo.Text    = "#";
         btnVerRecibo.Enabled = false;
         panCliente.Visible   = false;
         lblInfoCliente.Text  = "";
         recibo                             = null;
         myCliente                          = null;
         total                              = 0;
         lblValor.Text                      = "$0";
         txtIdentificacion.Text             = "";
         btnLiquidarTarifas.Enabled         = false;
         btnModificarPreliquidacion.Enabled = false;
     }
     catch (Exception exp)
     {
         MessageBox.Show("Ocurrio el siguiente error: " + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 24
0
        /**
         * Elimina un registro de la tabla
         * @param RECIBO obj
         * @return Retorna un boolean indicando si se realizo o no la operacion
         */
        public bool eliminarRECIBO(RECIBO obj)
        {
            bool resultado;

            resultado = false;
            try
            {
                RECIBODao dao = new RECIBODao();
                conn = conexion.conection();
                dao.delete(conn, obj);
                resultado = true;
            }
            catch (Exception e)
            {
                resultado = false;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(resultado);
        }
        private void anularRecibo(RECIBO recibo)
        {
            RECIBO_ESTADO estado = new RECIBO_ESTADO();

            estado.ID = recibo.ID_ESTADO;
            estado    = serviciosRECIBO_ESTADO.buscarPrimeroRECIBO_ESTADO(estado);
            if (estado != null && estado.ID > 0)
            {
                if (estado.ESTADO == "LIQUIDADO")
                {
                    estado        = new RECIBO_ESTADO();
                    estado.ESTADO = "ANULADO";
                    estado        = serviciosRECIBO_ESTADO.buscarPrimeroRECIBO_ESTADO(estado);
                    if (estado != null && estado.ID > 0)
                    {
                        recibo.ID_ESTADO = estado.ID;
                        if (serviciosRECIBO.editarRECIBO(recibo))
                        {
                            MessageBox.Show("El recibo fue anulado correctamente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            buscar();
                        }
                        else
                        {
                            MessageBox.Show("Ocurrio un error y el recibo no puede ser anulado", "Incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("El recibo no puede ser anulado porque no se ecnontro el estado anulado en el sistema", "Estado incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("El recibo no puede ser anulado porque no está en estado liquidado", "Estado incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private ObservableCollection <FacturaCompraModel> GetFacturas(long unidRecibo)
        {
            RECIBO recibo = new RECIBO()
            {
                UNID_RECIBO = unidRecibo
            };

            FacturaCompraDataMapper fcDataMapper = new FacturaCompraDataMapper();

            List <FACTURA> facturaList = fcDataMapper.GetFacturaList(recibo);

            ObservableCollection <FacturaCompraModel> facturas = new ObservableCollection <FacturaCompraModel>();

            facturaList.ForEach(f =>
            {
                FacturaCompraModel fcm = new FacturaCompraModel()
                {
                    UnidFactura  = f.UNID_FACTURA,
                    FechaFactura = (DateTime)f.FECHA_FACTURA,
                    IsActive     = f.IS_ACTIVE,
                    IsChecked    = false,
                    IsNew        = false,
                    Moneda       = new MonedaModel(null)
                    {
                        UnidMoneda = f.MONEDA.UNID_MONEDA,
                        MonedaName = f.MONEDA.MONEDA_NAME,
                        MonedaAbr  = f.MONEDA.MONEDA_ABR
                    },
                    TC             = f.TC,
                    NumeroFactura  = f.FACTURA_NUMERO,
                    FacturaDetalle = new ObservableCollection <FacturaCompraDetalleModel>(),
                    Proveedor      = new ProveedorModel(null)
                    {
                        UnidProveedor = f.PROVEEDOR.UNID_PROVEEDOR,
                        ProveedorName = f.PROVEEDOR.PROVEEDOR_NAME
                    },
                    PorIva          = f.IVA_POR == null ? 0d : (double)f.IVA_POR,
                    NumeroPedimento = f.NUMERO_PEDIMENTO,
                    TipoPedimento   = new TipoPedimentoModel(null)
                    {
                        UnidTipoPedimento = f.TIPO_PEDIMENTO.UNID_TIPO_PEDIMENTO,
                        TipoPedimentoName = f.TIPO_PEDIMENTO.TIPO_PEDIMENTO_NAME,
                        Clave             = f.TIPO_PEDIMENTO.CLAVE,
                        Nota    = f.TIPO_PEDIMENTO.NOTA,
                        Regimen = f.TIPO_PEDIMENTO.REGIMEN
                    }
                };

                f.FACTURA_DETALLE.ToList().ForEach(fd =>
                {
                    fcm.FacturaDetalle.Add(new FacturaCompraDetalleModel()
                    {
                        UnidFacturaCompraDetalle = fd.UNID_FACTURA_DETALE,
                        Articulo = new ArticuloModel()
                        {
                            UnidArticulo = fd.ARTICULO.UNID_ARTICULO,
                            ArticuloName = fd.ARTICULO.ARTICULO1,
                            Categoria    = fd.ARTICULO.CATEGORIA,
                            Equipo       = fd.ARTICULO.EQUIPO,
                            EquipoModel  = new EquipoModel(null)
                            {
                                UnidEquipo = fd.ARTICULO.EQUIPO.UNID_EQUIPO,
                                EquipoName = fd.ARTICULO.EQUIPO.EQUIPO_NAME
                            },
                            Marca  = fd.ARTICULO.MARCA,
                            Modelo = fd.ARTICULO.MODELO
                        },
                        Cantidad         = fd.CANTIDAD,
                        Descripcion      = fd.DESCRIPCION,
                        Factura          = fcm,
                        ImpuestoUnitario = fcm.PorIva,
                        IsActive         = fd.IS_ACTIVE,
                        Numero           = fd.NUMERO,
                        CostoUnitario    = fd.PRECIO_UNITARIO,
                        Unidad           = new UnidadModel(null)
                        {
                            UnidUnidad = fd.UNIDAD.UNID_UNIDAD,
                            UnidadName = fd.UNIDAD.UNIDAD1
                        }
                    });
                });

                facturas.Add(fcm);
            });//factura foreach

            return(facturas);
        }
Ejemplo n.º 27
0
        public RECIBO generarRECIBO(LIQUIDACION liquidacion, LIQUIDACION_DETALLE[] lstDetalles, VIEW_CLIENTE myCliente)
        {
            List <RECIBO> lista    = null;
            dsRecibo      dsRecibo = new dsRecibo();

            try
            {
                conn = conexion.conection();
                int numRecibo = Funciones.getId(conn, "RECIBOS");

                DataRow drEscuela = dsRecibo.ESCUELA.NewRow();
                Image   logo      = Resources.ResourceTmp.LogoConducimos;
                drEscuela["E_LOGO"]        = Funciones.Convertir_Imagen_Bytes(logo);
                drEscuela["E_NOMBRE"]      = "CENTRO DE ENSE�ANZA AUTOMOVIL�STICA CONDUCIMOS S.A.S";
                drEscuela["E_NUM_RECIBO"]  = numRecibo.ToString();
                drEscuela["E_FORMA_PAGO"]  = "Efectivo";
                drEscuela["E_SITIO_WEB"]   = "www.conducimos.com.co";
                drEscuela["E_NIT"]         = "900644828-1";
                drEscuela["E_DIRECCION"]   = "CRA 81 # 26-40";
                drEscuela["E_CIUDAD"]      = "Medell�n";
                drEscuela["E_TELEFONO"]    = "2566295";
                drEscuela["E_CODIGO_CIIU"] = "8559";
                dsRecibo.ESCUELA.Rows.Add(drEscuela);

                DataRow drCliente = dsRecibo.CLIENTE.NewRow();
                drCliente["C_TIPO_DOCUMENTO"]    = myCliente.TIPO_DOCUMENTO;
                drCliente["C_NOMBRES_APELLIDOS"] = myCliente.NOMBRES + " " + myCliente.APELLIDOS;
                drCliente["C_IDENTIFICACION"]    = myCliente.IDENTIFICACION;
                drCliente["C_DIRECCION"]         = myCliente.DIRECCION;
                drCliente["C_CIUDAD"]            = myCliente.CIUDAD;
                drCliente["C_TELEFONO"]          = myCliente.TELEFONO;
                drCliente["C_EMAIL"]             = myCliente.CORREO;
                dsRecibo.CLIENTE.Rows.Add(drCliente);

                TARIFA_CONCEPTOManagement tarifa_conceptoManagement = new TARIFA_CONCEPTOManagement();
                TARIFA_DETALLEManagement  tarifa_detalleManagement  = new TARIFA_DETALLEManagement();

                foreach (LIQUIDACION_DETALLE dETALLE in lstDetalles)
                {
                    TARIFA_DETALLE tarifaDetalle = new TARIFA_DETALLE();
                    tarifaDetalle.ID = dETALLE.ID_TARIFA_DETALLE;
                    tarifaDetalle    = tarifa_detalleManagement.buscarPrimeroTARIFA_DETALLE(tarifaDetalle);
                    if (tarifaDetalle != null && tarifaDetalle.ID_TARIFA_CONCEPTO > 0)
                    {
                        TARIFA_CONCEPTO concepto = new TARIFA_CONCEPTO();
                        concepto.ID = tarifaDetalle.ID_TARIFA_CONCEPTO;
                        concepto    = tarifa_conceptoManagement.buscarPrimeroTARIFA_CONCEPTO(concepto);
                        if (concepto != null && concepto.ID > 0)
                        {
                            DataRow drLiquidacion = dsRecibo.LIQUIDACION.NewRow();
                            drLiquidacion["L_CODIGO"]   = concepto.CODIGO;
                            drLiquidacion["L_CONCEPTO"] = concepto.NOMBRE;
                            drLiquidacion["L_CANTIDAD"] = 1;
                            drLiquidacion["L_UNIDAD"]   = 1;
                            drLiquidacion["L_VALOR"]    = dETALLE.VALOR_CONCEPTO;
                            drLiquidacion["L_IVA"]      = 0;
                            dsRecibo.LIQUIDACION.Rows.Add(drLiquidacion);
                        }
                    }
                }

                String fileName = "Recibo_" + myCliente.IDENTIFICACION.Trim() + "_No." + numRecibo + "_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss.F") + ".pdf";
                fileName = fileName.Replace('/', '-');
                fileName = fileName.Replace(' ', '_');
                String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Recibos";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                path += "\\" + fileName;
                crRecibo reciboCrystal = new crRecibo();
                reciboCrystal.SetDataSource(dsRecibo);
                reciboCrystal.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path);
                RECIBO recibo = new RECIBO();
                recibo.ARCHIVO_FISICO = File.ReadAllBytes(path);
                recibo.FECHA_RECIBO   = DateTime.Now.Date;
                recibo.ID_LIQUIDACION = liquidacion.ID;
                recibo.NUMERO_RECIBO  = numRecibo.ToString();
                recibo.VALOR          = liquidacion.TOTAL;
                recibo.ID_ESTADO      = 1;
                recibo = crearRECIBO(recibo);
                return(recibo);
            }
            catch (Exception e)
            {
                return(null);
            }
            finally
            {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
Ejemplo n.º 28
0
 public bool eliminarRECIBO(RECIBO obj)
 {
     return(gestionRECIBO.eliminarRECIBO(obj));
 }
Ejemplo n.º 29
0
 public RECIBO[] buscarRECIBO(RECIBO obj)
 {
     return(gestionRECIBO.buscarRECIBO(obj));
 }
Ejemplo n.º 30
0
 public RECIBO buscarPrimeroRECIBO(RECIBO obj)
 {
     return(gestionRECIBO.buscarPrimeroRECIBO(obj));
 }