function strDepositEntryExport(&$sRpt) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $lDepositID = $sRpt->lDepositID; $sqlStr = 'SELECT ' . strExportFields_Gifts() . "\n FROM gifts\n INNER JOIN gifts_campaigns ON gi_lCampID = gc_lKeyID\n INNER JOIN gifts_accounts ON gc_lAcctID = ga_lKeyID\n INNER JOIN people_names AS donor ON donor.pe_lKeyID = gi_lForeignID\n INNER JOIN admin_aco ON gi_lACOID = aco_lKeyID\n\n LEFT JOIN lists_generic AS payCat ON payCat.lgen_lKeyID = gi_lPaymentType\n LEFT JOIN lists_generic AS giftCat ON giftCat.lgen_lKeyID = gi_lMajorGiftCat\n LEFT JOIN lists_generic AS giftAttrib ON giftAttrib.lgen_lKeyID = gi_lAttributedTo\n LEFT JOIN sponsor ON sp_lKeyID = gi_lSponsorID\n LEFT JOIN people_names AS spon ON spon.pe_lKeyID = sp_lForeignID\n LEFT JOIN lists_generic AS gik ON gi_lGIK_ID = gik.lgen_lKeyID\n LEFT JOIN admin_users AS ackUser ON gi_lAckByID = ackUser.us_lKeyID\n WHERE NOT gi_bRetired AND NOT donor.pe_bRetired AND gi_lDepositLogID={$lDepositID}\n ORDER BY gi_lKeyID;"; $query = $this->db->query($sqlStr); return $this->dbutil->csv_from_result($query); }
private function strGiftTimeFrameExport(&$sRpt) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $this->groupedGiftOpts($sRpt, $bAggregateDonor, $bShowAccounts, $bShowCamps); if ($bAggregateDonor) { $bGroupViaDonor = $sRpt->bAggregateDonor; } else { $bGroupViaDonor = false; } if ($bGroupViaDonor) { $sqlStr = ' SELECT ' . strExportFields_GiftsDonorAggregate($bShowAccounts, $bShowCamps) . ' FROM gifts ' . $this->strRptTimeFrameInner($sRpt) . ' WHERE NOT pe_bRetired ' . $this->strRptTimeFrameWhere($sRpt) . $this->strRptTimeFrameGroup($sRpt) . ' ORDER BY pe_lKeyID;'; } else { $sqlStr = 'SELECT ' . strExportFields_Gifts() . ' FROM gifts INNER JOIN gifts_campaigns ON gi_lCampID = gc_lKeyID INNER JOIN gifts_accounts ON gc_lAcctID = ga_lKeyID INNER JOIN people_names AS donor ON donor.pe_lKeyID = gi_lForeignID INNER JOIN admin_aco ON gi_lACOID = aco_lKeyID LEFT JOIN lists_generic AS payCat ON payCat.lgen_lKeyID = gi_lPaymentType LEFT JOIN lists_generic AS giftCat ON giftCat.lgen_lKeyID = gi_lMajorGiftCat LEFT JOIN lists_generic AS giftAttrib ON giftAttrib.lgen_lKeyID = gi_lAttributedTo LEFT JOIN sponsor ON sp_lKeyID = gi_lSponsorID LEFT JOIN people_names AS spon ON spon.pe_lKeyID = sp_lForeignID LEFT JOIN lists_generic AS gik ON gi_lGIK_ID = gik.lgen_lKeyID LEFT JOIN admin_users AS ackUser ON gi_lAckByID = ackUser.us_lKeyID WHERE NOT donor.pe_bRetired ' . $this->strRptTimeFrameWhere($sRpt) . ' ORDER BY gi_lKeyID;'; } $query = $this->db->query($sqlStr); return $this->dbutil->csv_from_result($query); }