public void createGJ_LINE(GJ_LINE oGJ_LINE) { string sCons = string.Empty; double dTotalLinea = 0; try { string query = MapeoQuerySql.ObtenerPorId("AdminGeneralJournal.createGJ_LINE"); dTotalLinea = oGJ_LINE.CREDIT_AMOUNT + oGJ_LINE.DEBIT_AMOUNT; if (dTotalLinea > 0) { sCons = string.Format(query, oGJ_LINE.GJ_ID , oGJ_LINE.LINE_NO , oGJ_LINE.GL_ACCOUNT_ID , oGJ_LINE.DEBIT_AMOUNT , oGJ_LINE.CREDIT_AMOUNT); _trace.AppendLine(sCons); _oSQL.EjecutarDML(sCons); } } catch (Exception ex) { throw new Exception("Error al insertar en GJ_LINE. Detalle: " + ex.Message); } }
private GJ_LINE getGJ_LINE(int pEntry_No, string pCuenta, double pDebit, double pCredit) { GJ_LINE oGJ_Line = new GJ_LINE(); oGJ_Line.GJ_ID = ID; oGJ_Line.LINE_NO = pEntry_No; oGJ_Line.GL_ACCOUNT_ID = pCuenta; oGJ_Line.DEBIT_AMOUNT = pDebit; oGJ_Line.CREDIT_AMOUNT = pCredit; return(oGJ_Line); }
public List <GJ_LINE> getListGJ_LINE() { List <GJ_LINE> lstGJ_LINE = new List <GJ_LINE>(); int iEntry_No = 1; double dMontoFactura = 0; double dMontoPago = 0; string sCta_Origen = string.Empty; string sCta_Destino = string.Empty; double dPerdidaGanancia = 0; double dPerdida = 0; double dGanancia = 0; string sCtaPerdida = string.Empty; string sCtaGanancia = string.Empty; foreach (DataRow item in _dtVMX_IVATRASTEMP.Rows) { GJ_LINE oGJ_LINE = new GJ_LINE(); sCta_Origen = item["CUENTA_ORIGEN"].ToString(); sCta_Destino = item["CUENTA_DESTINO"].ToString(); dMontoFactura = double.Parse(item["MONTO"].ToString()); dMontoPago = double.Parse(item["MONTO_IVA_DEPOSITO"].ToString()); oGJ_LINE = getGJ_LINE(iEntry_No++, sCta_Destino, dMontoFactura, 0); lstGJ_LINE.Add(oGJ_LINE); if (TipoCambio.Equals("PAGO")) { oGJ_LINE = getGJ_LINE(iEntry_No++, sCta_Origen, 0, dMontoPago); } else { oGJ_LINE = getGJ_LINE(iEntry_No++, sCta_Origen, 0, dMontoFactura); } lstGJ_LINE.Add(oGJ_LINE); // Perdida Ganancia if (TipoCambio.Equals("PAGO")) { DataRow[] result = _dtDetalla_IVA.Select("VAT_GL_ACCTID = '" + sCta_Origen + "' AND TRASLADO = '" + sCta_Destino + "'"); foreach (DataRow rowDetalle in _dtDetalla_IVA.Rows) { dPerdidaGanancia = double.Parse(rowDetalle["PERDIDA_GANANCIA"].ToString()); if (rowDetalle["VAT_GL_ACCTID"].ToString().Equals(sCta_Origen) && rowDetalle["TRASLADO"].ToString().Equals(sCta_Destino) && dPerdidaGanancia < 0) { dPerdida += Math.Abs(dPerdidaGanancia); sCtaPerdida = rowDetalle["CUENTA_PER_GANANCIA"].ToString(); } else { dGanancia += dPerdidaGanancia; sCtaGanancia = rowDetalle["CUENTA_PER_GANANCIA"].ToString(); } } if (dGanancia > 0) { oGJ_LINE = getGJ_LINE(iEntry_No++, sCtaGanancia, dGanancia, 0); lstGJ_LINE.Add(oGJ_LINE); } if (dPerdida > 0) { oGJ_LINE = getGJ_LINE(iEntry_No++, sCtaPerdida, 0, dPerdida); lstGJ_LINE.Add(oGJ_LINE); } } } return(lstGJ_LINE); }