PageRenderTime 64ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/diezmolist.php

https://github.com/fredd-for/emaus_tesoreria
PHP | 709 lines | 499 code | 96 blank | 114 comment | 99 complexity | b1c45647145a3998bb412f3ed96fee07 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. session_start(); // Initialize session data
  3. ob_start(); // Turn on output buffering
  4. ?>
  5. <?php include "ewcfg6.php" ?>
  6. <?php include "ewmysql6.php" ?>
  7. <?php include "phpfn6.php" ?>
  8. <?php include "diezmoinfo.php" ?>
  9. <?php include "usuarioinfo.php" ?>
  10. <?php include "userfn6.php" ?>
  11. <?php include "Connections/conexion.php" ?>
  12. <?php
  13. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  14. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  15. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  16. header("Cache-Control: post-check=0, pre-check=0", false);
  17. header("Pragma: no-cache"); // HTTP/1.0
  18. ?>
  19. <?php
  20. // Define page object
  21. $diezmo_list = new cdiezmo_list();
  22. $Page =& $diezmo_list;
  23. // Page init processing
  24. $diezmo_list->Page_Init();
  25. // Page main processing
  26. $diezmo_list->Page_Main();
  27. ?>
  28. <?php include "header.php" ?>
  29. <link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
  30. <script type="text/javascript" src="calendar/calendar.js"></script>
  31. <script type="text/javascript" src="calendar/lang/calendar-es.js"></script>
  32. <script type="text/javascript" src="calendar/calendar-setup.js"></script>
  33. <script type="text/javascript">
  34. <!--
  35. var ew_DHTMLEditors = [];
  36. //-->
  37. </script>
  38. <script type="text/javascript">
  39. var x=$(document);
  40. x.ready(inicializarEventos);
  41. function inicializarEventos()
  42. { //alert("hola como estas");
  43. if(<?php echo $_REQUEST['total']?>){
  44. alert('TOTAL DIEZMO RECAUDADO ES : <?php echo $_REQUEST['total']?> Bs.');
  45. }
  46. tabla_diezmo();
  47. var v_fecha=$("#x_fecha");
  48. var v_anio=$("#anio");
  49. var v_mes=$("#mes");
  50. v_fecha.blur(tabla_diezmo);
  51. v_anio.change(tabla_diezmo);
  52. v_mes.change(tabla_diezmo);
  53. }
  54. function tabla_diezmo() {
  55. //alert ("holaa")
  56. var v_fecha=$("#x_fecha").attr("value")
  57. var pagina="diezmotabla.php?x_fecha="+v_fecha;
  58. var carga=$("#cargar_tabla");
  59. carga.load(pagina);
  60. carga.show("slow");
  61. return false;
  62. }
  63. </script>
  64. <?php
  65. //mysql_select_db($database_conexion, $conexion);
  66. //$query_miembro = "SELECT * FROM miembro WHERE diezma=1";
  67. //$mostrar_miembro= mysql_query($query_miembro, $conexion) or die(mysql_error());
  68. //$total_miembro= mysql_num_rows($mostrar_miembro);
  69. $anio=date("Y");
  70. $mes=date("m");
  71. ?>
  72. <!--<div>
  73. A&ntilde;o: <select name="anio" id="anio">
  74. <option value="2010" <?php if($anio=='2010'){ echo "selected"; } ?>>2010</option>
  75. <option value="2011" <?php if($anio=='2011'){ echo "selected"; } ?>>2011</option>
  76. <option value="2012" <?php if($anio=='2012'){ echo "selected"; } ?>>2012</option>
  77. <option value="2013" <?php if($anio=='2013'){ echo "selected"; } ?>>2013</option>
  78. <option value="2014" <?php if($anio=='2014'){ echo "selected"; } ?>>2014</option>
  79. <option value="2015" <?php if($anio=='2015'){ echo "selected"; } ?>>2015</option>
  80. </select>
  81. </div>
  82. <div>
  83. Mes: <select name="mes" id="mes">
  84. <option value="1" <?php if($mes=='1'){ echo "selected"; } ?>>Enero</option>
  85. <option value="2" <?php if($mes=='2'){ echo "selected"; } ?>>Febrero</option>
  86. <option value="3" <?php if($mes=='3'){ echo "selected"; } ?>>Marzo</option>
  87. <option value="4" <?php if($mes=='4'){ echo "selected"; } ?>>Abril</option>
  88. <option value="5" <?php if($mes=='5'){ echo "selected"; } ?>>Mayo</option>
  89. <option value="6" <?php if($mes=='6'){ echo "selected"; } ?>>Junio</option>
  90. <option value="7" <?php if($mes=='7'){ echo "selected"; } ?>>Julio</option>
  91. <option value="8" <?php if($mes=='8'){ echo "selected"; } ?>>Agosto</option>
  92. <option value="9" <?php if($mes=='9'){ echo "selected"; } ?>>Septiembre</option>
  93. <option value="10" <?php if($mes=='10'){ echo "selected"; } ?>>Octubre</option>
  94. <option value="11" <?php if($mes=='11'){ echo "selected"; } ?>>Noviembre</option>
  95. <option value="12" <?php if($mes=='12'){ echo "selected"; } ?>>Diciembre</option>
  96. </select>
  97. </div>-->
  98. <div id="divx_fecha">Fecha: <input type="text" name="x_fecha" id="x_fecha" value="<?php echo date("d-m-Y")?>">
  99. <script type="text/javascript">
  100. Calendar.setup({
  101. inputField : "x_fecha", // ID of the input field
  102. ifFormat : "%d-%m-%Y", // the date format
  103. button : "x_fecha" // ID of the button
  104. });
  105. </script>
  106. </div>
  107. <div id="cargar_tabla"></div>
  108. <?php include "footer.php" ?>
  109. <?php
  110. //
  111. // Page Class
  112. //
  113. class cdiezmo_list {
  114. // Page ID
  115. var $PageID = 'list';
  116. // Table Name
  117. var $TableName = 'diezmo';
  118. // Page Object Name
  119. var $PageObjName = 'diezmo_list';
  120. // Page Name
  121. function PageName() {
  122. return ew_CurrentPage();
  123. }
  124. // Page Url
  125. function PageUrl() {
  126. $PageUrl = ew_CurrentPage() . "?";
  127. global $diezmo;
  128. if ($diezmo->UseTokenInUrl) $PageUrl .= "t=" . $diezmo->TableVar . "&"; // add page token
  129. return $PageUrl;
  130. }
  131. // Message
  132. function getMessage() {
  133. return @$_SESSION[EW_SESSION_MESSAGE];
  134. }
  135. function setMessage($v) {
  136. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
  137. $_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
  138. } else {
  139. $_SESSION[EW_SESSION_MESSAGE] = $v;
  140. }
  141. }
  142. // Show Message
  143. function ShowMessage() {
  144. if ($this->getMessage() <> "") { // Message in Session, display
  145. echo "<p><span class=\"ewMessage\">" . $this->getMessage() . "</span></p>";
  146. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
  147. }
  148. }
  149. // Validate Page request
  150. function IsPageRequest() {
  151. global $objForm, $diezmo;
  152. if ($diezmo->UseTokenInUrl) {
  153. //IsPageRequest = False
  154. if ($objForm)
  155. return ($diezmo->TableVar == $objForm->GetValue("t"));
  156. if (@$_GET["t"] <> "")
  157. return ($diezmo->TableVar == $_GET["t"]);
  158. } else {
  159. return TRUE;
  160. }
  161. }
  162. //
  163. // Class initialize
  164. // - init objects
  165. // - open connection
  166. //
  167. function cdiezmo_list() {
  168. global $conn;
  169. // Initialize table object
  170. $GLOBALS["diezmo"] = new cdiezmo();
  171. // Initialize other table object
  172. $GLOBALS['usuario'] = new cusuario();
  173. // Intialize page id (for backward compatibility)
  174. if (!defined("EW_PAGE_ID"))
  175. define("EW_PAGE_ID", 'list', TRUE);
  176. // Initialize table name (for backward compatibility)
  177. if (!defined("EW_TABLE_NAME"))
  178. define("EW_TABLE_NAME", 'diezmo', TRUE);
  179. // Open connection to the database
  180. $conn = ew_Connect();
  181. // Initialize list options
  182. $this->ListOptions = new cListOptions();
  183. }
  184. //
  185. // Page_Init
  186. //
  187. function Page_Init() {
  188. global $gsExport, $gsExportFile, $diezmo;
  189. global $Security;
  190. $Security = new cAdvancedSecurity();
  191. if (!$Security->IsLoggedIn()) $Security->AutoLogin();
  192. if (!$Security->IsLoggedIn()) {
  193. $Security->SaveLastUrl();
  194. $this->Page_Terminate("login.php");
  195. }
  196. $Security->TablePermission_Loading();
  197. $Security->LoadCurrentUserLevel($this->TableName);
  198. $Security->TablePermission_Loaded();
  199. if (!$Security->IsLoggedIn()) {
  200. $Security->SaveLastUrl();
  201. $this->Page_Terminate("login.php");
  202. }
  203. if (!$Security->CanList()) {
  204. $Security->SaveLastUrl();
  205. $this->Page_Terminate("login.php");
  206. }
  207. $diezmo->Export = @$_GET["export"]; // Get export parameter
  208. $gsExport = $diezmo->Export; // Get export parameter, used in header
  209. $gsExportFile = $diezmo->TableVar; // Get export file, used in header
  210. if ($diezmo->Export == "excel") {
  211. header('Content-Type: application/vnd.ms-excel');
  212. header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
  213. }
  214. // Global page loading event (in userfn6.php)
  215. Page_Loading();
  216. // Page load event, used in current page
  217. $this->Page_Load();
  218. }
  219. //
  220. // Page_Terminate
  221. // - called when exit page
  222. // - if URL specified, redirect to the URL
  223. //
  224. function Page_Terminate($url = "") {
  225. global $conn;
  226. // Page unload event, used in current page
  227. $this->Page_Unload();
  228. // Global page unloaded event (in userfn*.php)
  229. Page_Unloaded();
  230. // Close Connection
  231. $conn->Close();
  232. // Go to URL if specified
  233. if ($url <> "") {
  234. ob_end_clean();
  235. header("Location: $url");
  236. }
  237. exit();
  238. }
  239. var $lDisplayRecs; // Number of display records
  240. var $lStartRec;
  241. var $lStopRec;
  242. var $lTotalRecs;
  243. var $lRecRange;
  244. var $sSrchWhere;
  245. var $lRecCnt;
  246. var $lEditRowCnt;
  247. var $lRowCnt;
  248. var $lRowIndex;
  249. var $lOptionCnt;
  250. var $lRecPerRow;
  251. var $lColCnt;
  252. var $sDeleteConfirmMsg; // Delete confirm message
  253. var $sDbMasterFilter;
  254. var $sDbDetailFilter;
  255. var $bMasterRecordExists;
  256. var $ListOptions;
  257. var $sMultiSelectKey;
  258. //
  259. // Page main processing
  260. //
  261. function Page_Main() {
  262. global $objForm, $gsSearchError, $Security, $diezmo;
  263. $this->lDisplayRecs = 20;
  264. $this->lRecRange = 10;
  265. $this->lRecCnt = 0; // Record count
  266. // Search filters
  267. $sSrchAdvanced = ""; // Advanced search filter
  268. $sSrchBasic = ""; // Basic search filter
  269. $sFilter = "";
  270. $this->sSrchWhere = ""; // Search WHERE clause
  271. $this->sDeleteConfirmMsg = "�Quiere borrar este registro?"; // Delete confirm message
  272. // Master/Detail
  273. $this->sDbMasterFilter = ""; // Master filter
  274. $this->sDbDetailFilter = ""; // Detail filter
  275. if ($this->IsPageRequest()) { // Validate request
  276. // Set up records per page dynamically
  277. $this->SetUpDisplayRecs();
  278. // Handle reset command
  279. $this->ResetCmd();
  280. // Set Up Sorting Order
  281. $this->SetUpSortOrder();
  282. } // End Validate Request
  283. // Restore display records
  284. if ($diezmo->getRecordsPerPage() <> "") {
  285. $this->lDisplayRecs = $diezmo->getRecordsPerPage(); // Restore from Session
  286. } else {
  287. $this->lDisplayRecs = 20; // Load default
  288. }
  289. // Load Sorting Order
  290. $this->LoadSortOrder();
  291. // Build filter
  292. $sFilter = "";
  293. if (!$Security->CanList()) {
  294. $sFilter = "(0=1)"; // Filter all records
  295. }
  296. if ($this->sDbDetailFilter <> "")
  297. $sFilter = ($sFilter <> "") ? "($sFilter) AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
  298. if ($this->sSrchWhere <> "")
  299. $sFilter = ($sFilter <> "") ? "($sFilter) AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
  300. // Set up filter in Session
  301. $diezmo->setSessionWhere($sFilter);
  302. $diezmo->CurrentFilter = "";
  303. // Export data only
  304. if (in_array($diezmo->Export, array("html","word","excel","xml","csv"))) {
  305. $this->ExportData();
  306. $this->Page_Terminate(); // Terminate response
  307. exit();
  308. }
  309. }
  310. // Set up number of records displayed per page
  311. function SetUpDisplayRecs() {
  312. global $diezmo;
  313. $sWrk = @$_GET[EW_TABLE_REC_PER_PAGE];
  314. if ($sWrk <> "") {
  315. if (is_numeric($sWrk)) {
  316. $this->lDisplayRecs = intval($sWrk);
  317. } else {
  318. if (strtolower($sWrk) == "all") { // Display all records
  319. $this->lDisplayRecs = -1;
  320. } else {
  321. $this->lDisplayRecs = 20; // Non-numeric, load default
  322. }
  323. }
  324. $diezmo->setRecordsPerPage($this->lDisplayRecs); // Save to Session
  325. // Reset start position
  326. $this->lStartRec = 1;
  327. $diezmo->setStartRecordNumber($this->lStartRec);
  328. }
  329. }
  330. // Set up Sort parameters based on Sort Links clicked
  331. function SetUpSortOrder() {
  332. global $diezmo;
  333. // Check for an Order parameter
  334. if (@$_GET["order"] <> "") {
  335. $diezmo->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
  336. $diezmo->CurrentOrderType = @$_GET["ordertype"];
  337. $diezmo->UpdateSort($diezmo->idDiezmo); // Field
  338. $diezmo->UpdateSort($diezmo->idMiembro); // Field
  339. $diezmo->UpdateSort($diezmo->fecha); // Field
  340. $diezmo->UpdateSort($diezmo->montoDiezmo); // Field
  341. $diezmo->setStartRecordNumber(1); // Reset start position
  342. }
  343. }
  344. // Load Sort Order parameters
  345. function LoadSortOrder() {
  346. global $diezmo;
  347. $sOrderBy = $diezmo->getSessionOrderBy(); // Get order by from Session
  348. if ($sOrderBy == "") {
  349. if ($diezmo->SqlOrderBy() <> "") {
  350. $sOrderBy = $diezmo->SqlOrderBy();
  351. $diezmo->setSessionOrderBy($sOrderBy);
  352. }
  353. }
  354. }
  355. // Reset command based on querystring parameter cmd=
  356. // - RESET: reset search parameters
  357. // - RESETALL: reset search & master/detail parameters
  358. // - RESETSORT: reset sort parameters
  359. function ResetCmd() {
  360. global $diezmo;
  361. // Get reset cmd
  362. if (@$_GET["cmd"] <> "") {
  363. $sCmd = $_GET["cmd"];
  364. // Reset sort criteria
  365. if (strtolower($sCmd) == "resetsort") {
  366. $sOrderBy = "";
  367. $diezmo->setSessionOrderBy($sOrderBy);
  368. $diezmo->idDiezmo->setSort("");
  369. $diezmo->idMiembro->setSort("");
  370. $diezmo->fecha->setSort("");
  371. $diezmo->montoDiezmo->setSort("");
  372. }
  373. // Reset start position
  374. $this->lStartRec = 1;
  375. $diezmo->setStartRecordNumber($this->lStartRec);
  376. }
  377. }
  378. // Set up Starting Record parameters based on Pager Navigation
  379. function SetUpStartRec() {
  380. global $diezmo;
  381. if ($this->lDisplayRecs == 0)
  382. return;
  383. if ($this->IsPageRequest()) { // Validate request
  384. if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
  385. $this->lStartRec = $_GET[EW_TABLE_START_REC];
  386. $diezmo->setStartRecordNumber($this->lStartRec);
  387. } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
  388. $this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
  389. if (is_numeric($this->nPageNo)) {
  390. $this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
  391. if ($this->lStartRec <= 0) {
  392. $this->lStartRec = 1;
  393. } elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
  394. $this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
  395. }
  396. $diezmo->setStartRecordNumber($this->lStartRec);
  397. }
  398. }
  399. }
  400. $this->lStartRec = $diezmo->getStartRecordNumber();
  401. // Check if correct start record counter
  402. if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
  403. $this->lStartRec = 1; // Reset start record counter
  404. $diezmo->setStartRecordNumber($this->lStartRec);
  405. } elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
  406. $this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
  407. $diezmo->setStartRecordNumber($this->lStartRec);
  408. } elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
  409. $this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
  410. $diezmo->setStartRecordNumber($this->lStartRec);
  411. }
  412. }
  413. // Load recordset
  414. function LoadRecordset($offset = -1, $rowcnt = -1) {
  415. global $conn, $diezmo;
  416. // Call Recordset Selecting event
  417. $diezmo->Recordset_Selecting($diezmo->CurrentFilter);
  418. // Load list page SQL
  419. $sSql = $diezmo->SelectSQL();
  420. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  421. // Load recordset
  422. $conn->raiseErrorFn = 'ew_ErrorFn';
  423. $rs = $conn->Execute($sSql);
  424. $conn->raiseErrorFn = '';
  425. // Call Recordset Selected event
  426. $diezmo->Recordset_Selected($rs);
  427. return $rs;
  428. }
  429. // Load row based on key values
  430. function LoadRow() {
  431. global $conn, $Security, $diezmo;
  432. $sFilter = $diezmo->KeyFilter();
  433. // Call Row Selecting event
  434. $diezmo->Row_Selecting($sFilter);
  435. // Load sql based on filter
  436. $diezmo->CurrentFilter = $sFilter;
  437. $sSql = $diezmo->SQL();
  438. if ($rs = $conn->Execute($sSql)) {
  439. if ($rs->EOF) {
  440. $LoadRow = FALSE;
  441. } else {
  442. $LoadRow = TRUE;
  443. $rs->MoveFirst();
  444. $this->LoadRowValues($rs); // Load row values
  445. // Call Row Selected event
  446. $diezmo->Row_Selected($rs);
  447. }
  448. $rs->Close();
  449. } else {
  450. $LoadRow = FALSE;
  451. }
  452. return $LoadRow;
  453. }
  454. // Load row values from recordset
  455. function LoadRowValues(&$rs) {
  456. global $diezmo;
  457. $diezmo->idDiezmo->setDbValue($rs->fields('idDiezmo'));
  458. $diezmo->idMiembro->setDbValue($rs->fields('idMiembro'));
  459. $diezmo->fecha->setDbValue($rs->fields('fecha'));
  460. $diezmo->montoDiezmo->setDbValue($rs->fields('montoDiezmo'));
  461. $diezmo->monto2->setDbValue($rs->fields('monto2'));
  462. $diezmo->monto3->setDbValue($rs->fields('monto3'));
  463. }
  464. // Render row values based on field settings
  465. function RenderRow() {
  466. global $conn, $Security, $diezmo;
  467. // Call Row_Rendering event
  468. $diezmo->Row_Rendering();
  469. // Common render codes for all row types
  470. // idDiezmo
  471. $diezmo->idDiezmo->CellCssStyle = "";
  472. $diezmo->idDiezmo->CellCssClass = "";
  473. // idMiembro
  474. $diezmo->idMiembro->CellCssStyle = "";
  475. $diezmo->idMiembro->CellCssClass = "";
  476. // fecha
  477. $diezmo->fecha->CellCssStyle = "";
  478. $diezmo->fecha->CellCssClass = "";
  479. // montoDiezmo
  480. $diezmo->montoDiezmo->CellCssStyle = "";
  481. $diezmo->montoDiezmo->CellCssClass = "";
  482. if ($diezmo->RowType == EW_ROWTYPE_VIEW) { // View row
  483. // idDiezmo
  484. $diezmo->idDiezmo->ViewValue = $diezmo->idDiezmo->CurrentValue;
  485. $diezmo->idDiezmo->CssStyle = "";
  486. $diezmo->idDiezmo->CssClass = "";
  487. $diezmo->idDiezmo->ViewCustomAttributes = "";
  488. // idMiembro
  489. $diezmo->idMiembro->ViewValue = $diezmo->idMiembro->CurrentValue;
  490. $diezmo->idMiembro->CssStyle = "";
  491. $diezmo->idMiembro->CssClass = "";
  492. $diezmo->idMiembro->ViewCustomAttributes = "";
  493. // fecha
  494. $diezmo->fecha->ViewValue = $diezmo->fecha->CurrentValue;
  495. $diezmo->fecha->ViewValue = ew_FormatDateTime($diezmo->fecha->ViewValue, 7);
  496. $diezmo->fecha->CssStyle = "";
  497. $diezmo->fecha->CssClass = "";
  498. $diezmo->fecha->ViewCustomAttributes = "";
  499. // montoDiezmo
  500. $diezmo->montoDiezmo->ViewValue = $diezmo->montoDiezmo->CurrentValue;
  501. $diezmo->montoDiezmo->CssStyle = "";
  502. $diezmo->montoDiezmo->CssClass = "";
  503. $diezmo->montoDiezmo->ViewCustomAttributes = "";
  504. // idDiezmo
  505. $diezmo->idDiezmo->HrefValue = "";
  506. // idMiembro
  507. $diezmo->idMiembro->HrefValue = "";
  508. // fecha
  509. $diezmo->fecha->HrefValue = "";
  510. // montoDiezmo
  511. $diezmo->montoDiezmo->HrefValue = "";
  512. }
  513. // Call Row Rendered event
  514. $diezmo->Row_Rendered();
  515. }
  516. // Export data in XML or CSV format
  517. function ExportData() {
  518. global $diezmo;
  519. $sCsvStr = "";
  520. // Default export style
  521. $sExportStyle = "h";
  522. // Load recordset
  523. $rs = $this->LoadRecordset();
  524. $this->lTotalRecs = $rs->RecordCount();
  525. $this->lStartRec = 1;
  526. // Export all
  527. if ($diezmo->ExportAll) {
  528. $this->lStopRec = $this->lTotalRecs;
  529. } else { // Export 1 page only
  530. $this->SetUpStartRec(); // Set up start record position
  531. // Set the last record to display
  532. if ($this->lDisplayRecs < 0) {
  533. $this->lStopRec = $this->lTotalRecs;
  534. } else {
  535. $this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
  536. }
  537. }
  538. if ($diezmo->Export == "xml") {
  539. $XmlDoc = new cXMLDocument();
  540. } else {
  541. echo ew_ExportHeader($diezmo->Export);
  542. // Horizontal format, write header
  543. if ($sExportStyle <> "v" || $diezmo->Export == "csv") {
  544. $sExportStr = "";
  545. ew_ExportAddValue($sExportStr, 'idDiezmo', $diezmo->Export);
  546. ew_ExportAddValue($sExportStr, 'idMiembro', $diezmo->Export);
  547. ew_ExportAddValue($sExportStr, 'fecha', $diezmo->Export);
  548. ew_ExportAddValue($sExportStr, 'montoDiezmo', $diezmo->Export);
  549. echo ew_ExportLine($sExportStr, $diezmo->Export);
  550. }
  551. }
  552. // Move to first record
  553. $this->lRecCnt = $this->lStartRec - 1;
  554. if (!$rs->EOF) {
  555. $rs->MoveFirst();
  556. $rs->Move($this->lStartRec - 1);
  557. }
  558. while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
  559. $this->lRecCnt++;
  560. if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
  561. $this->LoadRowValues($rs);
  562. // Render row for display
  563. $diezmo->RowType = EW_ROWTYPE_VIEW; // Render view
  564. $this->RenderRow();
  565. if ($diezmo->Export == "xml") {
  566. $XmlDoc->BeginRow();
  567. $XmlDoc->AddField('idDiezmo', $diezmo->idDiezmo->CurrentValue);
  568. $XmlDoc->AddField('idMiembro', $diezmo->idMiembro->CurrentValue);
  569. $XmlDoc->AddField('fecha', $diezmo->fecha->CurrentValue);
  570. $XmlDoc->AddField('montoDiezmo', $diezmo->montoDiezmo->CurrentValue);
  571. $XmlDoc->EndRow();
  572. } else {
  573. if ($sExportStyle == "v" && $diezmo->Export <> "csv") { // Vertical format
  574. echo ew_ExportField('idDiezmo', $diezmo->idDiezmo->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  575. echo ew_ExportField('idMiembro', $diezmo->idMiembro->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  576. echo ew_ExportField('fecha', $diezmo->fecha->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  577. echo ew_ExportField('montoDiezmo', $diezmo->montoDiezmo->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  578. } else { // Horizontal format
  579. $sExportStr = "";
  580. ew_ExportAddValue($sExportStr, $diezmo->idDiezmo->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  581. ew_ExportAddValue($sExportStr, $diezmo->idMiembro->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  582. ew_ExportAddValue($sExportStr, $diezmo->fecha->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  583. ew_ExportAddValue($sExportStr, $diezmo->montoDiezmo->ExportValue($diezmo->Export, $diezmo->ExportOriginalValue), $diezmo->Export);
  584. echo ew_ExportLine($sExportStr, $diezmo->Export);
  585. }
  586. }
  587. }
  588. $rs->MoveNext();
  589. }
  590. // Close recordset
  591. $rs->Close();
  592. if ($diezmo->Export == "xml") {
  593. header("Content-Type: text/xml");
  594. echo $XmlDoc->XML();
  595. } else {
  596. echo ew_ExportFooter($diezmo->Export);
  597. }
  598. }
  599. // Page Load event
  600. function Page_Load() {
  601. //echo "Page Load";
  602. }
  603. // Page Unload event
  604. function Page_Unload() {
  605. //echo "Page Unload";
  606. }
  607. // Form Custom Validate event
  608. function Form_CustomValidate(&$CustomError) {
  609. // Return error message in CustomError
  610. return TRUE;
  611. }
  612. }
  613. ?>