internal static string SELECT_BASE_PRESTAMO(QueryConditions conditions) { string lo = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.LoanRecord)); conditions.OidEntity = (conditions.Payment != null) ? conditions.Payment.Oid : 0; string query = SELECT_BASE(conditions) + @" INNER JOIN " + lo + @" AS LO ON LO.""OID"" = PF.""OID_OPERACION"" AND PF.""TIPO_PAGO"" = " + (long)ETipoPago.Prestamo + JOIN_PAYMENTS(QueryConditions.ConvertToCommonQuery(conditions), new long[] { (long)ETipoPago.Prestamo }, "LO"); return(query); }
internal static string SELECT_BASE_GASTO(QueryConditions conditions) { string ex = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.ExpenseRecord)); conditions.OidEntity = (conditions.Payment != null) ? conditions.Payment.Oid : 0; string query = SELECT_BASE(conditions) + @" INNER JOIN " + ex + @" AS GT ON GT.""OID"" = PF.""OID_OPERACION"" AND PF.""TIPO_PAGO"" = " + (long)conditions.PaymentType + JOIN_PAYMENTS(QueryConditions.ConvertToCommonQuery(conditions), new long[] { (long)ETipoPago.Gasto }, "GT"); return(query); }
internal static string SELECT_BASE_NOMINA(QueryConditions conditions) { string py = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.PayrollRecord)); conditions.OidEntity = (conditions.Payment != null) ? conditions.Payment.Oid : 0; string query = SELECT_BASE(conditions) + @" INNER JOIN " + py + @" AS NM ON NM.""OID"" = PF.""OID_OPERACION"" AND PF.""TIPO_PAGO"" = " + (long)ETipoPago.Nomina + JOIN_PAYMENTS(QueryConditions.ConvertToCommonQuery(conditions), new long[] { (long)ETipoPago.Nomina }, "NM"); return(query); }
internal static string SELECT_BASE_FACTURA(QueryConditions conditions) { string fp = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.InputInvoiceRecord)); string s = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.SerieRecord)); string gt = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.ExpenseRecord)); string ex = nHManager.Instance.GetSQLTable(typeof(moleQule.Store.Data.ExpedientRecord)); conditions.OidEntity = (conditions.Payment != null) ? conditions.Payment.Oid : 0; string query = SELECT_BASE(conditions) + @" INNER JOIN " + fp + @" AS FP ON PF.""OID_OPERACION"" = FP.""OID"" AND PF.""TIPO_PAGO"" = " + (long)conditions.PaymentType + @" LEFT JOIN " + s + @" AS SE ON SE.""OID"" = FP.""OID_SERIE"" LEFT JOIN " + gt + @" AS GT ON GT.""OID_FACTURA"" = FP.""OID"" LEFT JOIN " + ex + @" AS EX ON EX.""OID"" = GT.""OID_EXPEDIENTE""" + JOIN_PAYMENTS(QueryConditions.ConvertToCommonQuery(conditions), new long[] { (long)ETipoPago.Factura }, "FP"); return(query); }