コード例 #1
0
        private string IngresaLogFactura(vwIntegracionesVentas integraVentas, string transicion, string mensaje)
        {
            short  cumplePreCondiciones = 0;
            string mensajePreCondicion  = string.Empty;

            var precondiciones = getPreCondiciones(integraVentas.TIPODOCGP, integraVentas.NUMDOCGP, 0, string.Empty, transicion);

            int condicionesCumplidas = precondiciones.Where(x => x.cumplePreCondiciones == 1).Count();

            if (condicionesCumplidas == precondiciones.Count())
            {
                cumplePreCondiciones = 1;
                mensajePreCondicion  = precondiciones.First().msjPreCondiciones;
            }
            else
            {
                mensajePreCondicion = precondiciones.Where(x => x.cumplePreCondiciones == 0).First().msjPreCondiciones;     //sería bueno mostrar todas condiciones que no fueron cumplidas.
            }
            using (var db = this.getDbContextIntegra())
            {
                if (!this.probarConexionDBIntegra())
                {
                    throw new InvalidOperationException("No se pudo establecer la conexión con la bd de Integración. Documento Ariane: " + integraVentas.NUMDOCARN + " Documento GP:" + integraVentas.NUMDOCGP ?? string.Empty);
                }

                ObjectParameter ID = new ObjectParameter("ID", typeof(int));

                db.sp_LOGINTEGRACIONESInsert(ID, integraVentas.TIPODOCARN, integraVentas.NUMDOCARN, integraVentas.TIPODOCGP, integraVentas.NUMDOCGP, transicion, usuarioQueProcesa, Utiles.Izquierda(mensaje, 150), mensajePreCondicion, cumplePreCondiciones);

                return(ID.Value.ToString());
            }
        }
コード例 #2
0
        private string IngresaLogFactura(vwIntegracionesVentas integraVentas, short?soptype, string sopnumbe, string transicion, string msj, string msjLargo)
        {
            using (var db = this.getDbContextIntegra())
            {
                // verificar la conexión con el servidor de bd
                if (!this.probarConexionDBIntegra())
                {
                    throw new InvalidOperationException("No se pudo establecer la conexión con el servidor al tratar de ingresar el Log de la transacción. Prefactura: " + integraVentas.NUMDOCARN + " Factura:" + integraVentas.NUMDOCGP);
                }
                ObjectParameter ID = new ObjectParameter("ID", typeof(int));

                db.sp_LOGINTEGRACIONESInsert(ID, integraVentas.TIPODOCARN, integraVentas.NUMDOCARN, soptype, sopnumbe, transicion, usuarioQueProcesa, msj, msjLargo, 1);

                return(ID.Value.ToString());
            }
        }
コード例 #3
0
        /// <summary>
        /// Crea el xml de una factura sop a partir de una vista sql.
        /// </summary>
        private taSopHdrIvcInsert IntegraFacturaSOP(vwIntegracionesVentas preFacturasAIntegrar, string sTimeStamp)
        {
            string       eConnResult                = String.Empty;
            eConnectType docEConnectSOP             = new eConnectType();
            eConnectType entEconnect                = new eConnectType();
            FacturaDeVentaSOPBandejaDB documentoSOP = new FacturaDeVentaSOPBandejaDB(parametrosDB);
            eConnectMethods            eConnObject  = new eConnectMethods();

            var    dpf = getPrefacturasDetalle(preFacturasAIntegrar.NUMDOCARN, preFacturasAIntegrar.TIPODOCARN);
            string tipoContribuyente = LocArgentina_GetTipoContribuyente(preFacturasAIntegrar.IDCLIENTE);

            documentoSOP.preparaFacturaSOP(preFacturasAIntegrar, dpf, sTimeStamp, tipoContribuyente);
            docEConnectSOP.SOPTransactionType = new SOPTransactionType[] { documentoSOP.FacturaSop };
            serializa(docEConnectSOP);
            eConnResult = eConnObject.CreateTransactionEntity(parametrosDB.ConnStringTarget, this.SDocXml);
            return(documentoSOP.FacturaSop.taSopHdrIvcInsert);
        }
コード例 #4
0
        public void armaFacturaCaEconn(vwIntegracionesVentas preFacturasIntegCab, IList <vwPreFacturas> preFacturasDet, string sTimeStamp, string tipoContribuyente)
        {
            try
            {
                short soptype = preFacturasIntegCab.SOPTYPE_GP ?? 3;

                //var docId = parametrosDB.IdsDocumento.Where(x=>x.Key.CompareTo(tipoContribuyente)==0)?.First() ;
                string docId = string.Empty;
                parametrosDB.IdsDocumento.TryGetValue(tipoContribuyente.Trim(), out docId);

                if (string.IsNullOrEmpty(docId))
                {
                    throw new InvalidOperationException(string.Concat("No existe configurado el tipo de contribuyente ", tipoContribuyente, " en el archivo de parámetros. [FacturaDeVentaSOPBandejaDB.armaFacturaCaEconn]"));
                }

                string sopnumbe = getNextSopNumbe(soptype, docId);

                facturaSopCa.CREATETAXES = 1;   //1: crear impuestos automáticamente
                facturaSopCa.DEFPRICING  = 1;   //1: calcular automáticamente; 0:se debe indicar el precio unitario

                facturaSopCa.BACHNUMB = sTimeStamp;
                facturaSopCa.SOPTYPE  = soptype;
                facturaSopCa.DOCID    = docId;
                facturaSopCa.SOPNUMBE = sopnumbe;
                facturaSopCa.DOCDATE  = preFacturasIntegCab.FECHADOC.ToString(parametrosDB.FormatoFechaDB);
                facturaSopCa.CUSTNMBR = preFacturasIntegCab.IDCLIENTE;
                facturaSopCa.CSTPONBR = preFacturasIntegCab.NUMDOCARN;

                facturaSopCa.REFRENCE = preFacturasIntegCab.OBSERVACIONES;

                //facturaSopCa.SUBTOTAL = Decimal.Round(unitprice, 2);
                //facturaSopCa.DOCAMNT = facturaSopCa.SUBTOTAL;

                facturaSop.taSopLineIvcInsert_Items = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[preFacturasDet.Count];
                int i = 0;
                foreach (var d in preFacturasDet)
                {
                    facturaSopDe            = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();
                    facturaSopDe.SOPTYPE    = facturaSopCa.SOPTYPE;
                    facturaSopDe.SOPNUMBE   = facturaSopCa.SOPNUMBE;
                    facturaSopDe.CUSTNMBR   = facturaSopCa.CUSTNMBR;
                    facturaSopDe.DOCDATE    = facturaSopCa.DOCDATE;
                    facturaSopDe.ITEMNMBR   = d.IDITEM;
                    facturaSopDe.ITEMDESC   = d.DESCRIPCION;
                    facturaSopDe.QUANTITY   = d.CANTIDAD;
                    facturaSopDe.DEFPRICING = 1;     //1: calcular el precio y precio extendido automáticamente
                    //facturaSopDe.DEFEXTPRICE = 1;   //1: calcular el precio extendido en base al precio unitario y la cantidad
                    facturaSop.taSopLineIvcInsert_Items[i] = facturaSopDe;
                    i++;
                    //Decimal unitprice = 0;
                    //if (Decimal.TryParse(hojaXl.Cells[fila, int.Parse(param.FacturaSopUNITPRCE)].Value.ToString(), out unitprice))
                    //{
                    //    facturaSopDe.UNITPRCE = Decimal.Round(unitprice, 2);
                    //}
                    //else
                    //    throw new FormatException("El monto es incorrecto en la fila " + fila.ToString() + ", columna " + param.FacturaSopUNITPRCE + " [armaFacturaCaEconn]");
                }
            }
            catch (FormatException fmt)
            {
                throw new FormatException("Formato incorrecto [armaFacturaCaEconn]", fmt);
            }
            catch (OverflowException ovr)
            {
                throw new OverflowException("Monto demasiado grande [armaFacturaCaEconn]", ovr);
            }
            //finally
            //{
            //    trace.Flush();
            //    trace.Close();

            //}
        }
コード例 #5
0
        public void preparaFacturaSOP(vwIntegracionesVentas pfIntegraCab, IList <vwPreFacturas> preFacturasDet, string sTimeStamp, string tipoContribuyente)
        {
            armaFacturaCaEconn(pfIntegraCab, preFacturasDet, sTimeStamp, tipoContribuyente);

            facturaSop.taSopHdrIvcInsert = facturaSopCa;
        }