Ejemplo n.º 1
0
        private string getCustomer(string txrgnnum)
        {
            int    n       = 0;
            string cliente = string.Empty;

            using (EntitiesGP gp = new EntitiesGP(_DatosConexionDB.Elemento.EntityConnStr))
            {
                var c = gp.RM00101.Where(w => w.TXRGNNUM.Equals(txrgnnum.Trim()) && w.INACTIVE == 0)
                        .Select(s => new { custnmbr = s.CUSTNMBR.Trim() });
                n = c.Count();
                foreach (var r in c)
                {
                    cliente = r.custnmbr;
                }
            }
            if (n == 0)
            {
                throw new NullReferenceException("Cliente inexistente " + txrgnnum);
            }
            else if (n > 1)
            {
                throw new InvalidOperationException("Cliente con Id de impuesto duplicado " + txrgnnum);
            }

            return(cliente);
        }
Ejemplo n.º 2
0
        private void armaDetalleImpuestos(String taxschid)
        {
            using (EntitiesGP gp = new EntitiesGP(_DatosConexionDB.Elemento.EntityConnStr))
            {
                var detalleImpuestosCompras = gp.vwImpuestosPlanYDetalle.Where(w => w.TXDTLTYP.Equals(2) && w.taxschid.Equals(taxschid))
                                              .Select(s => new { s.TAXDTLID, s.TXDTLPCT });

                foreach (var impuesto in detalleImpuestosCompras)
                {
                    taPMTransactionTaxInsert_ItemsTaPMTransactionTaxInsert item = new taPMTransactionTaxInsert_ItemsTaPMTransactionTaxInsert();

                    item.VENDORID = facturaPm.VENDORID;
                    item.VCHRNMBR = facturaPm.VCHNUMWK;
                    item.DOCTYPE  = facturaPm.DOCTYPE;
                    item.BACHNUMB = facturaPm.BACHNUMB;
                    item.TAXDTLID = impuesto.TAXDTLID;

                    item.TAXAMNT  = Decimal.Round((facturaPm.PRCHAMNT - facturaPm.TRDISAMT) * impuesto.TXDTLPCT / 100, 2);
                    item.TDTTXPUR = facturaPm.PRCHAMNT - facturaPm.TRDISAMT;
                    item.TXDTTPUR = facturaPm.PRCHAMNT - facturaPm.TRDISAMT;

                    taxDetails.Add(item);
                }
            }
        }
Ejemplo n.º 3
0
        private bool existeIdImpuestoCliente(string txrgnnum)
        {
            int    n       = 0;
            string cliente = string.Empty;

            using (EntitiesGP gp = new EntitiesGP(_DatosConexionDB.Elemento.EntityConnStr))
            {
                var c = gp.RM00101.Where(w => w.TXRGNNUM.Equals(txrgnnum.Trim()) && w.INACTIVE == 0)
                        .Select(s => new { custnmbr = s.CUSTNMBR.Trim() });
                n = c.Count();
                foreach (var r in c)
                {
                    cliente = r.custnmbr;
                }
            }
            return(n != 0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Obtiene plan de impuestos del proveedor
        /// </summary>
        /// <param name="vendorid"></param>
        /// <returns></returns>
        private string getDatosProveedor(string vendorid)
        {
            int    n        = 0;
            string taxschid = string.Empty;

            using (EntitiesGP gp = new EntitiesGP(_DatosConexionDB.Elemento.EntityConnStr))
            {
                var c = gp.PM00200.Where(w => w.VENDORID.Equals(vendorid.Trim()))
                        .Select(s => new { taxschid = s.TAXSCHID });

                n = c.Count();
                foreach (var r in c)
                {
                    taxschid = r.taxschid;
                }
            }
            if (n == 0)
            {
                throw new NullReferenceException("Proveedor inexistente " + vendorid);
            }

            return(taxschid);
        }