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

/saldo_cuentalist.php

https://github.com/fredd-for/emaus_tesoreria
PHP | 1715 lines | 1319 code | 188 blank | 208 comment | 390 complexity | a6ec7b176cd550b1bf62ad7503f9ae9b MD5 | raw file
Possible License(s): LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  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 "saldo_cuentainfo.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. $saldo_cuenta_list = new csaldo_cuenta_list();
  22. $Page =& $saldo_cuenta_list;
  23. // Page init processing
  24. $saldo_cuenta_list->Page_Init();
  25. // Page main processing
  26. $saldo_cuenta_list->Page_Main();
  27. ?>
  28. <?php include "header.php" ?>
  29. <?php
  30. mysql_select_db($database_conexion, $conexion);
  31. $query_cuenta = "SELECT cuenta FROM cuenta WHERE idCuenta='".$_GET['idCuenta']."'";
  32. $mostrar_cuenta= mysql_query($query_cuenta, $conexion) or die(mysql_error());
  33. $row_cuenta= mysql_fetch_assoc($mostrar_cuenta);
  34. ?>
  35. <?php if ($saldo_cuenta->Export == "") { ?>
  36. <script type="text/javascript">
  37. <!--
  38. // Create page object
  39. var saldo_cuenta_list = new ew_Page("saldo_cuenta_list");
  40. // page properties
  41. saldo_cuenta_list.PageID = "list"; // page ID
  42. var EW_PAGE_ID = saldo_cuenta_list.PageID; // for backward compatibility
  43. // extend page with ValidateForm function
  44. saldo_cuenta_list.ValidateForm = function(fobj) {
  45. if (!this.ValidateRequired)
  46. return true; // ignore validation
  47. if (fobj.a_confirm && fobj.a_confirm.value == "F")
  48. return true;
  49. var i, elm, aelm, infix;
  50. var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
  51. for (i=0; i<rowcnt; i++) {
  52. infix = (fobj.key_count) ? String(i+1) : "";
  53. elm = fobj.elements["x" + infix + "_idCuenta"];
  54. if (elm && !ew_HasValue(elm))
  55. return ew_OnError(this, elm, "Por favor ingrese los campos requeridos - Cuenta");
  56. elm = fobj.elements["x" + infix + "_fecha"];
  57. if (elm && !ew_HasValue(elm))
  58. return ew_OnError(this, elm, "Por favor ingrese los campos requeridos - Fecha");
  59. elm = fobj.elements["x" + infix + "_fecha"];
  60. if (elm && !ew_CheckEuroDate(elm.value))
  61. return ew_OnError(this, elm, "Fecha incorrecta, formato = dd-mm-yyyy - Fecha");
  62. elm = fobj.elements["x" + infix + "_nro_fact_recibo"];
  63. if (elm && !ew_CheckInteger(elm.value))
  64. return ew_OnError(this, elm, "Entero Incorrecto - Nro Recibo");
  65. elm = fobj.elements["x" + infix + "_detalle"];
  66. if (elm && !ew_HasValue(elm))
  67. return ew_OnError(this, elm, "Por favor ingrese los campos requeridos - Detalle");
  68. elm = fobj.elements["x" + infix + "_ingreso"];
  69. if (elm && !ew_CheckNumber(elm.value))
  70. return ew_OnError(this, elm, "N�mero de Punto Flotante Incorrecto - Ingreso");
  71. elm = fobj.elements["x" + infix + "_egreso"];
  72. if (elm && !ew_CheckNumber(elm.value))
  73. return ew_OnError(this, elm, "N�mero de Punto Flotante Incorrecto - Egreso");
  74. // Call Form Custom Validate event
  75. if (!this.Form_CustomValidate(fobj)) return false;
  76. }
  77. return true;
  78. }
  79. // extend page with Form_CustomValidate function
  80. saldo_cuenta_list.Form_CustomValidate =
  81. function(fobj) { // DO NOT CHANGE THIS LINE!
  82. // Your custom validation code here, return false if invalid.
  83. return true;
  84. }
  85. <?php if (EW_CLIENT_VALIDATE) { ?>
  86. saldo_cuenta_list.ValidateRequired = true; // uses JavaScript validation
  87. <?php } else { ?>
  88. saldo_cuenta_list.ValidateRequired = false; // no JavaScript validation
  89. <?php } ?>
  90. //-->
  91. </script>
  92. <link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
  93. <script type="text/javascript" src="calendar/calendar.js"></script>
  94. <script type="text/javascript" src="calendar/lang/calendar-es.js"></script>
  95. <script type="text/javascript" src="calendar/calendar-setup.js"></script>
  96. <script type="text/javascript">
  97. <!--
  98. var ew_DHTMLEditors = [];
  99. //-->
  100. </script>
  101. <?php } ?>
  102. <?php if ($saldo_cuenta->Export == "") { ?>
  103. <?php } ?>
  104. <?php
  105. $bSelectLimit = ($saldo_cuenta->Export == "" && $saldo_cuenta->SelectLimit);
  106. if (!$bSelectLimit)
  107. $rs = $saldo_cuenta_list->LoadRecordset();
  108. $saldo_cuenta_list->lTotalRecs = ($bSelectLimit) ? $saldo_cuenta->SelectRecordCount() : $rs->RecordCount();
  109. $saldo_cuenta_list->lStartRec = 1;
  110. if ($saldo_cuenta_list->lDisplayRecs <= 0) // Display all records
  111. $saldo_cuenta_list->lDisplayRecs = $saldo_cuenta_list->lTotalRecs;
  112. if (!($saldo_cuenta->ExportAll && $saldo_cuenta->Export <> ""))
  113. $saldo_cuenta_list->SetUpStartRec(); // Set up start record position
  114. if ($bSelectLimit)
  115. $rs = $saldo_cuenta_list->LoadRecordset($saldo_cuenta_list->lStartRec-1, $saldo_cuenta_list->lDisplayRecs);
  116. ?>
  117. <p><span class="phpmaker" style="white-space: nowrap;">
  118. <?php if ($saldo_cuenta->Export == "" && $saldo_cuenta->CurrentAction == "") { ?>
  119. &nbsp;&nbsp;<a href="<?php echo $saldo_cuenta_list->PageUrl() ?>export=excel">Exportar a Excel</a>
  120. <?php } ?>
  121. </span></p>
  122. <?php $saldo_cuenta_list->ShowMessage() ?>
  123. <div style="color: blue; font-size: 15px">CUENTA:<b> <?php echo strtoupper($row_cuenta['cuenta'])?></b></div>
  124. <table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
  125. <div class="ewGridMiddlePanel">
  126. <form name="fsaldo_cuentalist" id="fsaldo_cuentalist" class="ewForm" action="<?php echo ew_CurrentPage() ?>?idCuenta=<?php echo $_GET['idCuenta']?>" method="post">
  127. <input type="hidden" name="t" id="t" value="saldo_cuenta">
  128. <?php if ($saldo_cuenta_list->lTotalRecs > 0 || $saldo_cuenta->CurrentAction == "add" || $saldo_cuenta->CurrentAction == "copy") { ?>
  129. <table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
  130. <?php
  131. $saldo_cuenta_list->lOptionCnt = 0;
  132. if ($Security->IsLoggedIn()) {
  133. $saldo_cuenta_list->lOptionCnt++; // edit
  134. }
  135. if ($Security->IsLoggedIn()) {
  136. $saldo_cuenta_list->lOptionCnt++; // Delete
  137. }
  138. $saldo_cuenta_list->lOptionCnt += count($saldo_cuenta_list->ListOptions->Items); // Custom list options
  139. ?>
  140. <?php echo $saldo_cuenta->TableCustomInnerHtml ?>
  141. <thead><!-- Table header -->
  142. <tr class="ewTableHeader">
  143. <?php if ($saldo_cuenta->idSaldoCuenta->Visible) { // idSaldoCuenta ?>
  144. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->idSaldoCuenta) == "") { ?>
  145. <td>No</td>
  146. <?php } else { ?>
  147. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->idSaldoCuenta) ?>',1);">
  148. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>No</td><td style="width: 10px;"><?php if ($saldo_cuenta->idSaldoCuenta->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->idSaldoCuenta->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  149. </td>
  150. <?php } ?>
  151. <?php } ?>
  152. <?php if ($saldo_cuenta->fecha->Visible) { // fecha ?>
  153. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->fecha) == "") { ?>
  154. <td>Fecha</td>
  155. <?php } else { ?>
  156. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->fecha) ?>',1);">
  157. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Fecha</td><td style="width: 10px;"><?php if ($saldo_cuenta->fecha->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->fecha->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  158. </td>
  159. <?php } ?>
  160. <?php } ?>
  161. <?php if ($saldo_cuenta->nro_fact_recibo->Visible) { // nro_fact_recibo ?>
  162. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->nro_fact_recibo) == "") { ?>
  163. <td>Nro Recibo</td>
  164. <?php } else { ?>
  165. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->nro_fact_recibo) ?>',1);">
  166. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Nro Recibo</td><td style="width: 10px;"><?php if ($saldo_cuenta->nro_fact_recibo->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->nro_fact_recibo->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  167. </td>
  168. <?php } ?>
  169. <?php } ?>
  170. <?php if ($saldo_cuenta->detalle->Visible) { // detalle ?>
  171. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->detalle) == "") { ?>
  172. <td>Detalle</td>
  173. <?php } else { ?>
  174. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->detalle) ?>',1);">
  175. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Detalle</td><td style="width: 10px;"><?php if ($saldo_cuenta->detalle->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->detalle->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  176. </td>
  177. <?php } ?>
  178. <?php } ?>
  179. <?php if ($saldo_cuenta->ingreso->Visible) { // ingreso ?>
  180. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->ingreso) == "") { ?>
  181. <td>Ingreso</td>
  182. <?php } else { ?>
  183. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->ingreso) ?>',1);">
  184. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Ingreso</td><td style="width: 10px;"><?php if ($saldo_cuenta->ingreso->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->ingreso->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  185. </td>
  186. <?php } ?>
  187. <?php } ?>
  188. <?php if ($saldo_cuenta->egreso->Visible) { // egreso ?>
  189. <?php if ($saldo_cuenta->SortUrl($saldo_cuenta->egreso) == "") { ?>
  190. <td>Egreso</td>
  191. <?php } else { ?>
  192. <td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $saldo_cuenta->SortUrl($saldo_cuenta->egreso) ?>',1);">
  193. <table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Egreso</td><td style="width: 10px;"><?php if ($saldo_cuenta->egreso->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($saldo_cuenta->egreso->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
  194. </td>
  195. <?php } ?>
  196. <?php } ?>
  197. <td>Saldo</td>
  198. <?php if ($saldo_cuenta->Export == "") { ?>
  199. <?php if ($Security->IsLoggedIn()) { ?>
  200. <td style="white-space: nowrap;">&nbsp;</td>
  201. <?php } ?>
  202. <?php if ($Security->IsLoggedIn()) { ?>
  203. <?php if ($saldo_cuenta_list->lOptionCnt == 0 && $saldo_cuenta->CurrentAction == "add") { ?>
  204. <td style="white-space: nowrap;">&nbsp;</td>
  205. <?php } ?>
  206. <?php } ?>
  207. <?php if ($Security->IsLoggedIn()) { ?>
  208. <td style="white-space: nowrap;">&nbsp;</td>
  209. <?php } ?>
  210. <?php
  211. // Custom list options
  212. foreach ($saldo_cuenta_list->ListOptions->Items as $ListOption) {
  213. if ($ListOption->Visible)
  214. echo $ListOption->HeaderCellHtml;
  215. }
  216. ?>
  217. <?php } ?>
  218. </tr>
  219. </thead>
  220. <?php
  221. if ($saldo_cuenta->ExportAll && $saldo_cuenta->Export <> "") {
  222. $saldo_cuenta_list->lStopRec = $saldo_cuenta_list->lTotalRecs;
  223. } else {
  224. $saldo_cuenta_list->lStopRec = $saldo_cuenta_list->lStartRec + $saldo_cuenta_list->lDisplayRecs - 1; // Set the last record to display
  225. }
  226. $saldo_cuenta_list->lRecCount = $saldo_cuenta_list->lStartRec - 1;
  227. if ($rs && !$rs->EOF) {
  228. $rs->MoveFirst();
  229. if (!$saldo_cuenta->SelectLimit && $saldo_cuenta_list->lStartRec > 1)
  230. $rs->Move($saldo_cuenta_list->lStartRec - 1);
  231. }
  232. $saldo_cuenta_list->lRowCnt = 0;
  233. $saldo_cuenta_list->lEditRowCnt = 0;
  234. $contador=1;
  235. $saldo=0;
  236. if ($saldo_cuenta->CurrentAction == "edit")
  237. $saldo_cuenta_list->lRowIndex = 1;
  238. while (($saldo_cuenta->CurrentAction == "gridadd" || !$rs->EOF) &&
  239. $saldo_cuenta_list->lRecCount < $saldo_cuenta_list->lStopRec) {
  240. $saldo_cuenta_list->lRecCount++;
  241. if (intval($saldo_cuenta_list->lRecCount) >= intval($saldo_cuenta_list->lStartRec)) {
  242. $saldo_cuenta_list->lRowCnt++;
  243. // Init row class and style
  244. $saldo_cuenta->CssClass = "";
  245. $saldo_cuenta->CssStyle = "";
  246. $saldo_cuenta->RowClientEvents = "onmouseover='ew_MouseOver(event, this);' onmouseout='ew_MouseOut(event, this);' onclick='ew_Click(event, this);'";
  247. if ($saldo_cuenta->CurrentAction == "gridadd") {
  248. $saldo_cuenta_list->LoadDefaultValues(); // Load default values
  249. } else {
  250. $saldo_cuenta_list->LoadRowValues($rs); // Load row values
  251. }
  252. $saldo_cuenta->RowType = EW_ROWTYPE_VIEW; // Render view
  253. if ($saldo_cuenta->CurrentAction == "edit") {
  254. if ($saldo_cuenta_list->CheckInlineEditKey() && $saldo_cuenta_list->lEditRowCnt == 0) // Inline edit
  255. $saldo_cuenta->RowType = EW_ROWTYPE_EDIT; // Render edit
  256. }
  257. if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT && $saldo_cuenta->EventCancelled) { // Update failed
  258. if ($saldo_cuenta->CurrentAction == "edit")
  259. $saldo_cuenta_list->RestoreFormValues(); // Restore form values
  260. }
  261. if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit row
  262. $saldo_cuenta_list->lEditRowCnt++;
  263. $saldo_cuenta->RowClientEvents = "onmouseover='this.edit=true;ew_MouseOver(event, this);' onmouseout='ew_MouseOut(event, this);' onclick='ew_Click(event, this);'";
  264. }
  265. if ($saldo_cuenta->RowType == EW_ROWTYPE_ADD || $saldo_cuenta->RowType == EW_ROWTYPE_EDIT) // Add / Edit row
  266. $saldo_cuenta->CssClass = "ewTableEditRow";
  267. // Render row
  268. $saldo_cuenta_list->RenderRow();
  269. ?>
  270. <tr<?php echo $saldo_cuenta->RowAttributes() ?>>
  271. <?php if ($saldo_cuenta->idSaldoCuenta->Visible) { // idSaldoCuenta ?>
  272. <td<?php echo $saldo_cuenta->idSaldoCuenta->CellAttributes() ?>>
  273. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  274. <div<?php echo $saldo_cuenta->idSaldoCuenta->ViewAttributes() ?>><?php echo $contador ?></div><input type="hidden" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idSaldoCuenta" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idSaldoCuenta" value="<?php echo ew_HtmlEncode($saldo_cuenta->idSaldoCuenta->CurrentValue) ?>">
  275. <?php } ?>
  276. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  277. <div<?php echo $saldo_cuenta->idSaldoCuenta->ViewAttributes() ?>><?php echo $contador ?></div>
  278. <?php } ?>
  279. </td>
  280. <?php } ?>
  281. <?php if ($saldo_cuenta->idCuenta->Visible) { // idCuenta ?>
  282. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  283. <input type="hidden" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idCuenta" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idCuenta" value="<?php echo strval($saldo_cuenta->idCuenta->CurrentValue)?>">
  284. <?php } ?>
  285. <?php } ?>
  286. <?php if ($saldo_cuenta->fecha->Visible) { // fecha ?>
  287. <td<?php echo $saldo_cuenta->fecha->CellAttributes() ?>>
  288. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  289. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" value="<?php echo $saldo_cuenta->fecha->EditValue ?>"<?php echo $saldo_cuenta->fecha->EditAttributes() ?> size="12">
  290. &nbsp;<img src="images/calendar.png" id="cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" name="cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" alt="Seleccione una fecha" style="cursor:pointer;cursor:hand;">
  291. <script type="text/javascript">
  292. Calendar.setup({
  293. inputField : "x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha", // ID of the input field
  294. ifFormat : "%d-%m-%Y", // the date format
  295. button : "cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" // ID of the button
  296. });
  297. </script>
  298. <?php } ?>
  299. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  300. <div<?php echo $saldo_cuenta->fecha->ViewAttributes() ?>><?php echo $saldo_cuenta->fecha->ListViewValue() ?></div>
  301. <?php } ?>
  302. </td>
  303. <?php } ?>
  304. <?php if ($saldo_cuenta->nro_fact_recibo->Visible) { // nro_fact_recibo ?>
  305. <td<?php echo $saldo_cuenta->nro_fact_recibo->CellAttributes() ?>>
  306. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  307. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_nro_fact_recibo" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_nro_fact_recibo" size="10" value="<?php echo $saldo_cuenta->nro_fact_recibo->EditValue ?>"<?php echo $saldo_cuenta->nro_fact_recibo->EditAttributes() ?>>
  308. <?php } ?>
  309. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  310. <div<?php echo $saldo_cuenta->nro_fact_recibo->ViewAttributes() ?>><?php echo $saldo_cuenta->nro_fact_recibo->ListViewValue() ?></div>
  311. <?php } ?>
  312. </td>
  313. <?php } ?>
  314. <?php if ($saldo_cuenta->detalle->Visible) { // detalle ?>
  315. <td<?php echo $saldo_cuenta->detalle->CellAttributes() ?>>
  316. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  317. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_detalle" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_detalle" size="30" maxlength="255" value="<?php echo $saldo_cuenta->detalle->EditValue ?>"<?php echo $saldo_cuenta->detalle->EditAttributes() ?>>
  318. <?php } ?>
  319. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  320. <div<?php echo $saldo_cuenta->detalle->ViewAttributes() ?>><?php echo $saldo_cuenta->detalle->ListViewValue() ?></div>
  321. <?php } ?>
  322. </td>
  323. <?php } ?>
  324. <?php if ($saldo_cuenta->ingreso->Visible) { // ingreso ?>
  325. <td<?php echo $saldo_cuenta->ingreso->CellAttributes() ?>>
  326. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  327. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_ingreso" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_ingreso" size="10" value="<?php echo $saldo_cuenta->ingreso->EditValue ?>"<?php echo $saldo_cuenta->ingreso->EditAttributes() ?>>
  328. <?php } ?>
  329. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  330. <div<?php echo $saldo_cuenta->ingreso->ViewAttributes() ?> align="right"><?php if($saldo_cuenta->ingreso->ListViewValue()<>'0'){echo $saldo_cuenta->ingreso->ListViewValue();} ?></div>
  331. <?php } ?>
  332. </td>
  333. <?php } ?>
  334. <?php if ($saldo_cuenta->egreso->Visible) { // egreso ?>
  335. <td<?php echo $saldo_cuenta->egreso->CellAttributes() ?>>
  336. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  337. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_egreso" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_egreso" size="10" value="<?php echo $saldo_cuenta->egreso->EditValue ?>"<?php echo $saldo_cuenta->egreso->EditAttributes() ?>>
  338. <?php } ?>
  339. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  340. <div<?php echo $saldo_cuenta->egreso->ViewAttributes() ?> align="right"><?php if($saldo_cuenta->egreso->ListViewValue()<>'0'){echo $saldo_cuenta->egreso->ListViewValue();} ?></div>
  341. <?php } ?>
  342. </td>
  343. <?php } ?>
  344. <?php if ($saldo_cuenta->egreso->Visible) { // egreso ?>
  345. <td<?php echo $saldo_cuenta->egreso->CellAttributes() ?>>
  346. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
  347. &nbsp;
  348. <?php } ?>
  349. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View record ?>
  350. <div<?php echo $saldo_cuenta->egreso->ViewAttributes() ?> align="right"><?php $saldo=$saldo+$saldo_cuenta->ingreso->ListViewValue()-$saldo_cuenta->egreso->ListViewValue(); echo number_format($saldo, 2)?></div>
  351. <?php } ?>
  352. </td>
  353. <?php } ?>
  354. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_ADD || $saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { ?>
  355. <?php if ($saldo_cuenta->CurrentAction == "edit") { ?>
  356. <td colspan="<?php echo $saldo_cuenta_list->lOptionCnt ?>"><span class="phpmaker">
  357. <a href="" onclick="if (saldo_cuenta_list.ValidateForm(document.fsaldo_cuentalist)) document.fsaldo_cuentalist.submit();return false;">Guardar</a>&nbsp;<a href="<?php echo $saldo_cuenta_list->PageUrl() ?>a=cancel&idCuenta=<?php echo $_GET['idCuenta']?>">Cancelar</a>
  358. <input type="hidden" name="a_list" id="a_list" value="update">
  359. </span></td>
  360. <?php } ?>
  361. <?php } else { ?>
  362. <?php if ($saldo_cuenta->Export == "") { ?>
  363. <?php if ($Security->IsLoggedIn()) { ?>
  364. <td style="white-space: nowrap;"><span class="phpmaker">
  365. <a href="<?php echo $saldo_cuenta->InlineEditUrl() ?>&idCuenta=<?php echo $_GET['idCuenta']?>">Editar</a>
  366. </span></td>
  367. <?php } ?>
  368. <?php if ($Security->IsLoggedIn()) { ?>
  369. <?php if ($saldo_cuenta_list->lOptionCnt == 0 && $saldo_cuenta->CurrentAction == "add") { ?>
  370. <td style="white-space: nowrap;">&nbsp;</td>
  371. <?php } ?>
  372. <?php } ?>
  373. <?php if ($Security->IsLoggedIn()) { ?>
  374. <td style="white-space: nowrap;"><span class="phpmaker">
  375. <a onclick="ew_ClickDelete(this);return ew_ConfirmDelete('<?php echo $saldo_cuenta_list->sDeleteConfirmMsg ?>', this);" href="<?php echo $saldo_cuenta->DeleteUrl() ?>&idCuenta=<?php echo $_GET['idCuenta']?>">Borrar</a>
  376. </span></td>
  377. <?php } ?>
  378. <?php
  379. // Custom list options
  380. foreach ($saldo_cuenta_list->ListOptions->Items as $ListOption) {
  381. if ($ListOption->Visible)
  382. echo $ListOption->BodyCellHtml;
  383. }
  384. ?>
  385. <?php } ?>
  386. <?php } ?>
  387. </tr>
  388. <?php if ($saldo_cuenta->RowType == EW_ROWTYPE_EDIT) { ?>
  389. <?php } ?>
  390. <?php
  391. }
  392. $contador++;
  393. if ($saldo_cuenta->CurrentAction <> "gridadd")
  394. $rs->MoveNext();
  395. }
  396. ?>
  397. </tbody>
  398. <?php
  399. if ($saldo_cuenta->CurrentAction == "add" || $saldo_cuenta->CurrentAction == "copy") {
  400. $saldo_cuenta_list->lRowIndex = 1;
  401. if ($saldo_cuenta->CurrentAction == "add")
  402. $saldo_cuenta_list->LoadDefaultValues();
  403. if ($saldo_cuenta->EventCancelled) // Insert failed
  404. $saldo_cuenta_list->RestoreFormValues(); // Restore form values
  405. // Set row properties
  406. $saldo_cuenta->CssClass = "ewTableEditRow";
  407. $saldo_cuenta->CssStyle = "";
  408. $saldo_cuenta->RowClientEvents = "onmouseover='ew_MouseOver(event, this);' onmouseout='ew_MouseOut(event, this);' onclick='ew_Click(event, this);'";
  409. $saldo_cuenta->RowType = EW_ROWTYPE_ADD;
  410. // Render row
  411. $saldo_cuenta_list->RenderRow();
  412. ?>
  413. <tr<?php echo $saldo_cuenta->RowAttributes() ?>>
  414. <?php if ($saldo_cuenta->idSaldoCuenta->Visible) { // idSaldoCuenta ?>
  415. <td>&nbsp;</td>
  416. <?php } ?>
  417. <?php if ($saldo_cuenta->idCuenta->Visible) { // idCuenta ?>
  418. <input type="hidden" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idCuenta" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_idCuenta" value="<?php echo $_GET['idCuenta']?>">
  419. <?php } ?>
  420. <?php if ($saldo_cuenta->fecha->Visible) { // fecha ?>
  421. <td>
  422. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" size="12">
  423. &nbsp;<img src="images/calendar.png" id="cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" name="cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" alt="Seleccione una fecha" style="cursor:pointer;cursor:hand;">
  424. <script type="text/javascript">
  425. Calendar.setup({
  426. inputField : "x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha", // ID of the input field
  427. ifFormat : "%d-%m-%Y", // the date format
  428. button : "cal_x<?php echo $saldo_cuenta_list->lRowIndex ?>_fecha" // ID of the button
  429. });
  430. </script>
  431. </td>
  432. <?php } ?>
  433. <?php if ($saldo_cuenta->nro_fact_recibo->Visible) { // nro_fact_recibo ?>
  434. <td>
  435. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_nro_fact_recibo" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_nro_fact_recibo" size="10">
  436. </td>
  437. <?php } ?>
  438. <?php if ($saldo_cuenta->detalle->Visible) { // detalle ?>
  439. <td>
  440. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_detalle" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_detalle" size="30" maxlength="255" >
  441. </td>
  442. <?php } ?>
  443. <?php if ($saldo_cuenta->ingreso->Visible) { // ingreso ?>
  444. <td>
  445. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_ingreso" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_ingreso" size="12">
  446. </td>
  447. <?php } ?>
  448. <?php if ($saldo_cuenta->egreso->Visible) { // egreso ?>
  449. <td>
  450. <input type="text" name="x<?php echo $saldo_cuenta_list->lRowIndex ?>_egreso" id="x<?php echo $saldo_cuenta_list->lRowIndex ?>_egreso" size="12" >
  451. </td>
  452. <td>&nbsp;</td>
  453. <?php } ?>
  454. <td colspan="<?php echo $saldo_cuenta_list->lOptionCnt ?>"><span class="phpmaker">
  455. <a href="" onclick="if (saldo_cuenta_list.ValidateForm(document.fsaldo_cuentalist)) document.fsaldo_cuentalist.submit();return false;">Guardar</a>&nbsp;<a href="<?php echo $saldo_cuenta_list->PageUrl() ?>a=cancel&idCuenta=<?php echo $_GET['idCuenta']?>">Cancelar</a>
  456. <input type="hidden" name="a_list" id="a_list" value="insert">
  457. </span></td>
  458. </tr>
  459. <?php
  460. }
  461. ?>
  462. </table>
  463. <?php } ?>
  464. <?php if ($saldo_cuenta->CurrentAction == "add" || $saldo_cuenta->CurrentAction == "copy") { ?>
  465. <input type="hidden" name="key_count" id="key_count" value="<?php echo $saldo_cuenta_list->lRowIndex ?>">
  466. <?php } ?>
  467. <?php if ($saldo_cuenta->CurrentAction == "edit") { ?>
  468. <input type="hidden" name="key_count" id="key_count" value="<?php echo $saldo_cuenta_list->lRowIndex ?>">
  469. <?php } ?>
  470. </form>
  471. <?php
  472. // Close recordset
  473. if ($rs)
  474. $rs->Close();
  475. ?>
  476. </div>
  477. <?php if ($saldo_cuenta->Export == "") { ?>
  478. <div class="ewGridLowerPanel">
  479. <?php if ($saldo_cuenta->CurrentAction <> "gridadd" && $saldo_cuenta->CurrentAction <> "gridedit") { ?>
  480. <form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
  481. <table border="0" cellspacing="0" cellpadding="0" class="ewPager">
  482. <tr>
  483. <td nowrap>
  484. <?php if (!isset($saldo_cuenta_list->Pager)) $saldo_cuenta_list->Pager = new cPrevNextPager($saldo_cuenta_list->lStartRec, $saldo_cuenta_list->lDisplayRecs, $saldo_cuenta_list->lTotalRecs) ?>
  485. <?php if ($saldo_cuenta_list->Pager->RecordCount > 0) { ?>
  486. <table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker">Pgina&nbsp;</span></td>
  487. <!--first page button-->
  488. <?php if ($saldo_cuenta_list->Pager->FirstButton->Enabled) { ?>
  489. <td><a href="<?php echo $saldo_cuenta_list->PageUrl() ?>start=<?php echo $saldo_cuenta_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="Primera" width="16" height="16" border="0"></a></td>
  490. <?php } else { ?>
  491. <td><img src="images/firstdisab.gif" alt="Primera" width="16" height="16" border="0"></td>
  492. <?php } ?>
  493. <!--previous page button-->
  494. <?php if ($saldo_cuenta_list->Pager->PrevButton->Enabled) { ?>
  495. <td><a href="<?php echo $saldo_cuenta_list->PageUrl() ?>start=<?php echo $saldo_cuenta_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="Anterior" width="16" height="16" border="0"></a></td>
  496. <?php } else { ?>
  497. <td><img src="images/prevdisab.gif" alt="Anterior" width="16" height="16" border="0"></td>
  498. <?php } ?>
  499. <!--current page number-->
  500. <td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $saldo_cuenta_list->Pager->CurrentPage ?>" size="4"></td>
  501. <!--next page button-->
  502. <?php if ($saldo_cuenta_list->Pager->NextButton->Enabled) { ?>
  503. <td><a href="<?php echo $saldo_cuenta_list->PageUrl() ?>start=<?php echo $saldo_cuenta_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="Siguiente" width="16" height="16" border="0"></a></td>
  504. <?php } else { ?>
  505. <td><img src="images/nextdisab.gif" alt="Siguiente" width="16" height="16" border="0"></td>
  506. <?php } ?>
  507. <!--last page button-->
  508. <?php if ($saldo_cuenta_list->Pager->LastButton->Enabled) { ?>
  509. <td><a href="<?php echo $saldo_cuenta_list->PageUrl() ?>start=<?php echo $saldo_cuenta_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="Ultima" width="16" height="16" border="0"></a></td>
  510. <?php } else { ?>
  511. <td><img src="images/lastdisab.gif" alt="Ultima" width="16" height="16" border="0"></td>
  512. <?php } ?>
  513. <td><span class="phpmaker">&nbsp;de <?php echo $saldo_cuenta_list->Pager->PageCount ?></span></td>
  514. </tr></table>
  515. </td>
  516. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  517. <td>
  518. <span class="phpmaker">Registro <?php echo $saldo_cuenta_list->Pager->FromIndex ?> a <?php echo $saldo_cuenta_list->Pager->ToIndex ?> de <?php echo $saldo_cuenta_list->Pager->RecordCount ?></span>
  519. <?php } else { ?>
  520. <?php if ($saldo_cuenta_list->sSrchWhere == "0=101") { ?>
  521. <span class="phpmaker">Por favor ingrese criterio de busqueda</span>
  522. <?php } else { ?>
  523. <span class="phpmaker">No se encontraron registros</span>
  524. <?php } ?>
  525. <?php } ?>
  526. </td>
  527. <?php if ($saldo_cuenta_list->lTotalRecs > 0) { ?>
  528. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  529. <td><table border="0" cellspacing="0" cellpadding="0"><tr><td>Registros por pgina&nbsp;</td><td>
  530. <input type="hidden" id="t" name="t" value="saldo_cuenta">
  531. <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onchange="this.form.submit();" class="phpmaker">
  532. <option value="20"<?php if ($saldo_cuenta_list->lDisplayRecs == 20) { ?> selected="selected"<?php } ?>>20</option>
  533. <option value="50"<?php if ($saldo_cuenta_list->lDisplayRecs == 50) { ?> selected="selected"<?php } ?>>50</option>
  534. <option value="ALL"<?php if ($saldo_cuenta->getRecordsPerPage() == -1) { ?> selected="selected"<?php } ?>>Todos los registros</option>
  535. </select></td></tr></table>
  536. </td>
  537. <?php } ?>
  538. </tr>
  539. </table>
  540. </form>
  541. <?php } ?>
  542. <?php //if ($saldo_cuenta_list->lTotalRecs > 0) { ?>
  543. <span class="phpmaker">
  544. <?php if ($Security->IsLoggedIn()) { ?>
  545. <a href="<?php echo $saldo_cuenta_list->PageUrl() ?>a=add&idCuenta=<?php echo $_GET['idCuenta']?>">Adicionar Transaccion</a>&nbsp;&nbsp;
  546. <?php } ?>
  547. </span>
  548. <?php //} ?>
  549. </div>
  550. <?php } ?>
  551. </td></tr></table>
  552. <br>
  553. <br>
  554. <?php
  555. mysql_select_db($database_conexion, $conexion);
  556. $query_cuentaSaldo = "SELECT * FROM cuenta WHERE estado = 1 Order by cuenta";
  557. $mostrar_cuentaSaldo= mysql_query($query_cuentaSaldo, $conexion) or die(mysql_error());
  558. $total_cuentaSaldo= mysql_num_rows($mostrar_cuentaSaldo);
  559. ?>
  560. <table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
  561. <div class="ewGridMiddlePanel">
  562. <table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
  563. <tr class="ewTableHeader">
  564. <td>No</td>
  565. <td>Cuenta</td>
  566. <td>Saldo</td>
  567. </tr>
  568. <?php
  569. $totalsaldo=0;
  570. while($row_cuentaSaldo=mysql_fetch_assoc($mostrar_cuentaSaldo)){
  571. mysql_select_db($database_conexion, $conexion);
  572. $query_saldo= "SELECT idCuenta, sum(ingreso)-sum(egreso) as saldo FROM saldo_cuenta WHERE idCuenta='".$row_cuentaSaldo['idCuenta']."' AND estado=1 GROUP BY idCuenta";
  573. $mostrar_saldo= mysql_query($query_saldo, $conexion) or die(mysql_error());
  574. $row_saldo=mysql_fetch_assoc($mostrar_saldo);
  575. $total_saldo= mysql_num_rows($mostrar_saldo);
  576. ?>
  577. <tr>
  578. <td><?php echo $row_cuentaSaldo['idCuenta']?></td>
  579. <td><?php echo $row_cuentaSaldo['cuenta']?></td>
  580. <td align="right"><?php printf("%0.2f",$row_saldo['saldo'])?></td>
  581. </tr>
  582. <?php
  583. $totalsaldo=$totalsaldo+$row_saldo['saldo'];
  584. }
  585. ?>
  586. <tr style="background: navy; color: white">
  587. <td></td>
  588. <td>TOTAL SALDO</td>
  589. <td><?php printf("%0.2f",$totalsaldo)?></td>
  590. </tr>
  591. </table>
  592. </div></td></tr></table>
  593. <?php include "footer.php" ?>
  594. <?php
  595. //
  596. // Page Class
  597. //
  598. class csaldo_cuenta_list {
  599. // Page ID
  600. var $PageID = 'list';
  601. // Table Name
  602. var $TableName = 'saldo_cuenta';
  603. // Page Object Name
  604. var $PageObjName = 'saldo_cuenta_list';
  605. // Page Name
  606. function PageName() {
  607. return ew_CurrentPage();
  608. }
  609. // Page Url
  610. function PageUrl() {
  611. $PageUrl = ew_CurrentPage() . "?";
  612. global $saldo_cuenta;
  613. if ($saldo_cuenta->UseTokenInUrl) $PageUrl .= "t=" . $saldo_cuenta->TableVar . "&"; // add page token
  614. return $PageUrl;
  615. }
  616. // Message
  617. function getMessage() {
  618. return @$_SESSION[EW_SESSION_MESSAGE];
  619. }
  620. function setMessage($v) {
  621. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
  622. $_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
  623. } else {
  624. $_SESSION[EW_SESSION_MESSAGE] = $v;
  625. }
  626. }
  627. // Show Message
  628. function ShowMessage() {
  629. if ($this->getMessage() <> "") { // Message in Session, display
  630. echo "<p><span class=\"ewMessage\">" . $this->getMessage() . "</span></p>";
  631. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
  632. }
  633. }
  634. // Validate Page request
  635. function IsPageRequest() {
  636. global $objForm, $saldo_cuenta;
  637. if ($saldo_cuenta->UseTokenInUrl) {
  638. //IsPageRequest = False
  639. if ($objForm)
  640. return ($saldo_cuenta->TableVar == $objForm->GetValue("t"));
  641. if (@$_GET["t"] <> "")
  642. return ($saldo_cuenta->TableVar == $_GET["t"]);
  643. } else {
  644. return TRUE;
  645. }
  646. }
  647. //
  648. // Class initialize
  649. // - init objects
  650. // - open connection
  651. //
  652. function csaldo_cuenta_list() {
  653. global $conn;
  654. // Initialize table object
  655. $GLOBALS["saldo_cuenta"] = new csaldo_cuenta();
  656. // Initialize other table object
  657. $GLOBALS['usuario'] = new cusuario();
  658. // Intialize page id (for backward compatibility)
  659. if (!defined("EW_PAGE_ID"))
  660. define("EW_PAGE_ID", 'list', TRUE);
  661. // Initialize table name (for backward compatibility)
  662. if (!defined("EW_TABLE_NAME"))
  663. define("EW_TABLE_NAME", 'saldo_cuenta', TRUE);
  664. // Open connection to the database
  665. $conn = ew_Connect();
  666. // Initialize list options
  667. $this->ListOptions = new cListOptions();
  668. }
  669. //
  670. // Page_Init
  671. //
  672. function Page_Init() {
  673. global $gsExport, $gsExportFile, $saldo_cuenta;
  674. global $Security;
  675. $Security = new cAdvancedSecurity();
  676. if (!$Security->IsLoggedIn()) $Security->AutoLogin();
  677. if (!$Security->IsLoggedIn()) {
  678. $Security->SaveLastUrl();
  679. $this->Page_Terminate("login.php");
  680. }
  681. $saldo_cuenta->Export = @$_GET["export"]; // Get export parameter
  682. $gsExport = $saldo_cuenta->Export; // Get export parameter, used in header
  683. $gsExportFile = $saldo_cuenta->TableVar; // Get export file, used in header
  684. if ($saldo_cuenta->Export == "excel") {
  685. header('Content-Type: application/vnd.ms-excel');
  686. header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
  687. }
  688. // Global page loading event (in userfn6.php)
  689. Page_Loading();
  690. // Page load event, used in current page
  691. $this->Page_Load();
  692. }
  693. //
  694. // Page_Terminate
  695. // - called when exit page
  696. // - if URL specified, redirect to the URL
  697. //
  698. function Page_Terminate($url = "") {
  699. global $conn;
  700. // Page unload event, used in current page
  701. $this->Page_Unload();
  702. // Global page unloaded event (in userfn*.php)
  703. Page_Unloaded();
  704. // Close Connection
  705. $conn->Close();
  706. // Go to URL if specified
  707. if ($url <> "") {
  708. ob_end_clean();
  709. header("Location: $url");
  710. }
  711. exit();
  712. }
  713. var $lDisplayRecs; // Number of display records
  714. var $lStartRec;
  715. var $lStopRec;
  716. var $lTotalRecs;
  717. var $lRecRange;
  718. var $sSrchWhere;
  719. var $lRecCnt;
  720. var $lEditRowCnt;
  721. var $lRowCnt;
  722. var $lRowIndex;
  723. var $lOptionCnt;
  724. var $lRecPerRow;
  725. var $lColCnt;
  726. var $sDeleteConfirmMsg; // Delete confirm message
  727. var $sDbMasterFilter;
  728. var $sDbDetailFilter;
  729. var $bMasterRecordExists;
  730. var $ListOptions;
  731. var $sMultiSelectKey;
  732. //
  733. // Page main processing
  734. //
  735. function Page_Main() {
  736. global $objForm, $gsSearchError, $Security, $saldo_cuenta;
  737. $this->lDisplayRecs = 20;
  738. $this->lRecRange = 10;
  739. $this->lRecCnt = 0; // Record count
  740. // Search filters
  741. $sSrchAdvanced = ""; // Advanced search filter
  742. $sSrchBasic = ""; // Basic search filter
  743. $sFilter = "";
  744. $this->sSrchWhere = ""; // Search WHERE clause
  745. $this->sDeleteConfirmMsg = "�Quiere borrar este registro?"; // Delete confirm message
  746. // Master/Detail
  747. $this->sDbMasterFilter = ""; // Master filter
  748. $this->sDbDetailFilter = ""; // Detail filter
  749. // Create form object
  750. $objForm = new cFormObj();
  751. if ($this->IsPageRequest()) { // Validate request
  752. // Set up records per page dynamically
  753. $this->SetUpDisplayRecs();
  754. // Handle reset command
  755. $this->ResetCmd();
  756. // Check QueryString parameters
  757. if (@$_GET["a"] <> "") {
  758. $saldo_cuenta->CurrentAction = $_GET["a"];
  759. // Clear inline mode
  760. if ($saldo_cuenta->CurrentAction == "cancel")
  761. $this->ClearInlineMode();
  762. // Switch to inline edit mode
  763. if ($saldo_cuenta->CurrentAction == "edit")
  764. $this->InlineEditMode();
  765. // Switch to inline add mode
  766. if ($saldo_cuenta->CurrentAction == "add" || $saldo_cuenta->CurrentAction == "copy")
  767. $this->InlineAddMode();
  768. } else {
  769. if (@$_POST["a_list"] <> "") {
  770. $saldo_cuenta->CurrentAction = $_POST["a_list"]; // Get action
  771. // Inline Update
  772. if ($saldo_cuenta->CurrentAction == "update" && @$_SESSION[EW_SESSION_INLINE_MODE] == "edit")
  773. $this->InlineUpdate();
  774. // Insert Inline
  775. if ($saldo_cuenta->CurrentAction == "insert" && @$_SESSION[EW_SESSION_INLINE_MODE] == "add")
  776. $this->InlineInsert();
  777. }
  778. }
  779. // Set Up Sorting Order
  780. $this->SetUpSortOrder();
  781. } // End Validate Request
  782. // Restore display records
  783. if ($saldo_cuenta->getRecordsPerPage() <> "") {
  784. //$this->lDisplayRecs =$saldo_cuenta->getRecordsPerPage(); // Restore from Session
  785. $this->lDisplayRecs =-1;
  786. } else {
  787. //$this->lDisplayRecs =20; // Load default
  788. $this->lDisplayRecs =-1;
  789. }
  790. // Load Sorting Order
  791. $this->LoadSortOrder();
  792. // Build filter
  793. $sFilter = "";
  794. if ($this->sDbDetailFilter <> "")
  795. $sFilter = ($sFilter <> "") ? "($sFilter) AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
  796. if ($this->sSrchWhere <> "")
  797. $sFilter = ($sFilter <> "") ? "($sFilter) AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
  798. // Set up filter in Session
  799. $saldo_cuenta->setSessionWhere($sFilter);
  800. $saldo_cuenta->CurrentFilter = "";
  801. // Export data only
  802. if (in_array($saldo_cuenta->Export, array("html","word","excel","xml","csv"))) {
  803. $this->ExportData();
  804. $this->Page_Terminate(); // Terminate response
  805. exit();
  806. }
  807. }
  808. // Set up number of records displayed per page
  809. function SetUpDisplayRecs() {
  810. global $saldo_cuenta;
  811. $sWrk = @$_GET[EW_TABLE_REC_PER_PAGE];
  812. if ($sWrk <> "") {
  813. if (is_numeric($sWrk)) {
  814. $this->lDisplayRecs = intval($sWrk);
  815. } else {
  816. if (strtolower($sWrk) == "all") { // Display all records
  817. $this->lDisplayRecs = -1;
  818. } else {
  819. $this->lDisplayRecs = 20; // Non-numeric, load default
  820. }
  821. }
  822. $saldo_cuenta->setRecordsPerPage($this->lDisplayRecs); // Save to Session
  823. // Reset start position
  824. $this->lStartRec = 1;
  825. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  826. }
  827. }
  828. // Exit out of inline mode
  829. function ClearInlineMode() {
  830. global $saldo_cuenta;
  831. $saldo_cuenta->setKey("idSaldoCuenta", ""); // Clear inline edit key
  832. $saldo_cuenta->CurrentAction = ""; // Clear action
  833. $_SESSION[EW_SESSION_INLINE_MODE] = ""; // Clear inline mode
  834. }
  835. // Switch to Inline Edit Mode
  836. function InlineEditMode() {
  837. global $Security, $saldo_cuenta;
  838. $bInlineEdit = TRUE;
  839. if (@$_GET["idSaldoCuenta"] <> "") {
  840. $saldo_cuenta->idSaldoCuenta->setQueryStringValue($_GET["idSaldoCuenta"]);
  841. } else {
  842. $bInlineEdit = FALSE;
  843. }
  844. if ($bInlineEdit) {
  845. if ($this->LoadRow()) {
  846. $saldo_cuenta->setKey("idSaldoCuenta", $saldo_cuenta->idSaldoCuenta->CurrentValue); // Set up inline edit key
  847. $_SESSION[EW_SESSION_INLINE_MODE] = "edit"; // Enable inline edit
  848. }
  849. }
  850. }
  851. // Peform update to inline edit record
  852. function InlineUpdate() {
  853. global $objForm, $gsFormError, $saldo_cuenta;
  854. $objForm->Index = 1;
  855. $this->LoadFormValues(); // Get form values
  856. // Validate Form
  857. $bInlineUpdate = TRUE;
  858. if (!$this->ValidateForm()) {
  859. $bInlineUpdate = FALSE; // Form error, reset action
  860. $this->setMessage($gsFormError);
  861. } else {
  862. $bInlineUpdate = FALSE;
  863. if ($this->CheckInlineEditKey()) { // Check key
  864. $saldo_cuenta->SendEmail = TRUE; // Send email on update success
  865. $bInlineUpdate = $this->EditRow(); // Update record
  866. } else {
  867. $bInlineUpdate = FALSE;
  868. }
  869. }
  870. if ($bInlineUpdate) { // Update success
  871. $this->setMessage("Actualizacion exitosa"); // Set success message
  872. $this->ClearInlineMode(); // Clear inline edit mode
  873. } else {
  874. if ($this->getMessage() == "")
  875. $this->setMessage("Actualizacion a fallado"); // Set update failed message
  876. $saldo_cuenta->EventCancelled = TRUE; // Cancel event
  877. $saldo_cuenta->CurrentAction = "edit"; // Stay in edit mode
  878. }
  879. }
  880. // Check inline edit key
  881. function CheckInlineEditKey() {
  882. global $saldo_cuenta;
  883. //CheckInlineEditKey = True
  884. if (strval($saldo_cuenta->getKey("idSaldoCuenta")) <> strval($saldo_cuenta->idSaldoCuenta->CurrentValue))
  885. return FALSE;
  886. return TRUE;
  887. }
  888. // Switch to Inline Add Mode
  889. function InlineAddMode() {
  890. global $Security, $saldo_cuenta;
  891. $saldo_cuenta->CurrentAction = "add";
  892. $_SESSION[EW_SESSION_INLINE_MODE] = "add"; // Enable inline add
  893. }
  894. // Peform update to inline add/copy record
  895. function InlineInsert() {
  896. global $objForm, $gsFormError, $saldo_cuenta;
  897. $objForm->Index = 1;
  898. $this->LoadFormValues(); // Get form values
  899. // Validate Form
  900. if (!$this->ValidateForm()) {
  901. $this->setMessage($gsFormError); // Set validation error message
  902. $saldo_cuenta->EventCancelled = TRUE; // Set event cancelled
  903. $saldo_cuenta->CurrentAction = "add"; // Stay in add mode
  904. return;
  905. }
  906. $saldo_cuenta->SendEmail = TRUE; // Send email on add success
  907. if ($this->AddRow()) { // Add record
  908. $this->setMessage("Registro agregado satisfactoriamente"); // Set add success message
  909. $this->ClearInlineMode(); // Clear inline add mode
  910. } else { // Add failed
  911. $saldo_cuenta->EventCancelled = TRUE; // Set event cancelled
  912. $saldo_cuenta->CurrentAction = "add"; // Stay in add mode
  913. }
  914. }
  915. // Set up Sort parameters based on Sort Links clicked
  916. function SetUpSortOrder() {
  917. global $saldo_cuenta;
  918. // Check for an Order parameter
  919. if (@$_GET["order"] <> "") {
  920. $saldo_cuenta->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
  921. $saldo_cuenta->CurrentOrderType = @$_GET["ordertype"];
  922. $saldo_cuenta->UpdateSort($saldo_cuenta->idSaldoCuenta); // Field
  923. $saldo_cuenta->UpdateSort($saldo_cuenta->idCuenta); // Field
  924. $saldo_cuenta->UpdateSort($saldo_cuenta->fecha); // Field
  925. $saldo_cuenta->UpdateSort($saldo_cuenta->nro_fact_recibo); // Field
  926. $saldo_cuenta->UpdateSort($saldo_cuenta->detalle); // Field
  927. $saldo_cuenta->UpdateSort($saldo_cuenta->ingreso); // Field
  928. $saldo_cuenta->UpdateSort($saldo_cuenta->egreso); // Field
  929. $saldo_cuenta->setStartRecordNumber(1); // Reset start position
  930. }
  931. }
  932. // Load Sort Order parameters
  933. function LoadSortOrder() {
  934. global $saldo_cuenta;
  935. $sOrderBy = $saldo_cuenta->getSessionOrderBy(); // Get order by from Session
  936. if ($sOrderBy == "") {
  937. if ($saldo_cuenta->SqlOrderBy() <> "") {
  938. $sOrderBy = $saldo_cuenta->SqlOrderBy();
  939. $saldo_cuenta->setSessionOrderBy($sOrderBy);
  940. }
  941. }
  942. }
  943. // Reset command based on querystring parameter cmd=
  944. // - RESET: reset search parameters
  945. // - RESETALL: reset search & master/detail parameters
  946. // - RESETSORT: reset sort parameters
  947. function ResetCmd() {
  948. global $saldo_cuenta;
  949. // Get reset cmd
  950. if (@$_GET["cmd"] <> "") {
  951. $sCmd = $_GET["cmd"];
  952. // Reset sort criteria
  953. if (strtolower($sCmd) == "resetsort") {
  954. $sOrderBy = "";
  955. $saldo_cuenta->setSessionOrderBy($sOrderBy);
  956. $saldo_cuenta->idSaldoCuenta->setSort("");
  957. $saldo_cuenta->idCuenta->setSort("");
  958. $saldo_cuenta->fecha->setSort("");
  959. $saldo_cuenta->nro_fact_recibo->setSort("");
  960. $saldo_cuenta->detalle->setSort("");
  961. $saldo_cuenta->ingreso->setSort("");
  962. $saldo_cuenta->egreso->setSort("");
  963. }
  964. // Reset start position
  965. $this->lStartRec = 1;
  966. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  967. }
  968. }
  969. // Set up Starting Record parameters based on Pager Navigation
  970. function SetUpStartRec() {
  971. global $saldo_cuenta;
  972. if ($this->lDisplayRecs == 0)
  973. return;
  974. if ($this->IsPageRequest()) { // Validate request
  975. if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
  976. $this->lStartRec = $_GET[EW_TABLE_START_REC];
  977. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  978. } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
  979. $this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
  980. if (is_numeric($this->nPageNo)) {
  981. $this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
  982. if ($this->lStartRec <= 0) {
  983. $this->lStartRec = 1;
  984. } elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
  985. $this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
  986. }
  987. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  988. }
  989. }
  990. }
  991. $this->lStartRec = $saldo_cuenta->getStartRecordNumber();
  992. // Check if correct start record counter
  993. if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
  994. $this->lStartRec = 1; // Reset start record counter
  995. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  996. } elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
  997. $this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
  998. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  999. } elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
  1000. $this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
  1001. $saldo_cuenta->setStartRecordNumber($this->lStartRec);
  1002. }
  1003. }
  1004. // Load default values
  1005. function LoadDefaultValues() {
  1006. global $saldo_cuenta;
  1007. }
  1008. // Load form values
  1009. function LoadFormValues() {
  1010. // Load from form
  1011. global $objForm, $saldo_cuenta;
  1012. $saldo_cuenta->idSaldoCuenta->setFormValue($objForm->GetValue("x_idSaldoCuenta"));
  1013. $saldo_cuenta->idCuenta->setFormValue($objForm->GetValue("x_idCuenta"));
  1014. $saldo_cuenta->fecha->setFormValue($objForm->GetValue("x_fecha"));
  1015. $saldo_cuenta->fecha->CurrentValue = ew_UnFormatDateTime($saldo_cuenta->fecha->CurrentValue, 7);
  1016. $saldo_cuenta->nro_fact_recibo->setFormValue($objForm->GetValue("x_nro_fact_recibo"));
  1017. $saldo_cuenta->detalle->setFormValue($objForm->GetValue("x_detalle"));
  1018. $saldo_cuenta->ingreso->setFormValue($objForm->GetValue("x_ingreso"));
  1019. $saldo_cuenta->egreso->setFormValue($objForm->GetValue("x_egreso"));
  1020. }
  1021. // Restore form values
  1022. function RestoreFormValues() {
  1023. global $saldo_cuenta;
  1024. $saldo_cuenta->idSaldoCuenta->CurrentValue = $saldo_cuenta->idSaldoCuenta->FormValue;
  1025. $saldo_cuenta->idCuenta->CurrentValue = $saldo_cuenta->idCuenta->FormValue;
  1026. $saldo_cuenta->fecha->CurrentValue = $saldo_cuenta->fecha->FormValue;
  1027. $saldo_cuenta->fecha->CurrentValue = ew_UnFormatDateTime($saldo_cuenta->fecha->CurrentValue, 7);
  1028. $saldo_cuenta->nro_fact_recibo->CurrentValue = $saldo_cuenta->nro_fact_recibo->FormValue;
  1029. $saldo_cuenta->detalle->CurrentValue = $saldo_cuenta->detalle->FormValue;
  1030. $saldo_cuenta->ingreso->CurrentValue = $saldo_cuenta->ingreso->FormValue;
  1031. $saldo_cuenta->egreso->CurrentValue = $saldo_cuenta->egreso->FormValue;
  1032. }
  1033. // Load recordset
  1034. function LoadRecordset($offset = -1, $rowcnt = -1) {
  1035. global $conn, $saldo_cuenta;
  1036. // Call Recordset Selecting event
  1037. $saldo_cuenta->Recordset_Selecting($saldo_cuenta->CurrentFilter);
  1038. // Load list page SQL
  1039. $sSql = $saldo_cuenta->SelectSQL();
  1040. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  1041. // Load recordset
  1042. $conn->raiseErrorFn = 'ew_ErrorFn';
  1043. $rs = $conn->Execute($sSql);
  1044. $conn->raiseErrorFn = '';
  1045. // Call Recordset Selected event
  1046. $saldo_cuenta->Recordset_Selected($rs);
  1047. return $rs;
  1048. }
  1049. // Load row based on key values
  1050. function LoadRow() {
  1051. global $conn, $Security, $saldo_cuenta;
  1052. $sFilter = $saldo_cuenta->KeyFilter();
  1053. // Call Row Selecting event
  1054. $saldo_cuenta->Row_Selecting($sFilter);
  1055. // Load sql based on filter
  1056. $saldo_cuenta->CurrentFilter = $sFilter;
  1057. $sSql = $saldo_cuenta->SQL();
  1058. if ($rs = $conn->Execute($sSql)) {
  1059. if ($rs->EOF) {
  1060. $LoadRow = FALSE;
  1061. } else {
  1062. $LoadRow = TRUE;
  1063. $rs->MoveFirst();
  1064. $this->LoadRowValues($rs); // Load row values
  1065. // Call Row Selected event
  1066. $saldo_cuenta->Row_Selected($rs);
  1067. }
  1068. $rs->Close();
  1069. } else {
  1070. $LoadRow = FALSE;
  1071. }
  1072. return $LoadRow;
  1073. }
  1074. // Load row values from recordset
  1075. function LoadRowValues(&$rs) {
  1076. global $saldo_cuenta;
  1077. $saldo_cuenta->idSaldoCuenta->setDbValue($rs->fields('idSaldoCuenta'));
  1078. $saldo_cuenta->idCuenta->setDbValue($rs->fields('idCuenta'));
  1079. $saldo_cuenta->fecha->setDbValue($rs->fields('fecha'));
  1080. $saldo_cuenta->nro_fact_recibo->setDbValue($rs->fields('nro_fact_recibo'));
  1081. $saldo_cuenta->detalle->setDbValue($rs->fields('detalle'));
  1082. $saldo_cuenta->ingreso->setDbValue($rs->fields('ingreso'));
  1083. $saldo_cuenta->egreso->setDbValue($rs->fields('egreso'));
  1084. $saldo_cuenta->fechaCreacion->setDbValue($rs->fields('fechaCreacion'));
  1085. $saldo_cuenta->fechaModificacion->setDbValue($rs->fields('fechaModificacion'));
  1086. $saldo_cuenta->diezmo->setDbValue($rs->fields('diezmo'));
  1087. }
  1088. // Render row values based on field settings
  1089. function RenderRow() {
  1090. global $conn, $Security, $saldo_cuenta;
  1091. // Call Row_Rendering event
  1092. $saldo_cuenta->Row_Rendering();
  1093. // Common render codes for all row types
  1094. // idSaldoCuenta
  1095. $saldo_cuenta->idSaldoCuenta->CellCssStyle = "";
  1096. $saldo_cuenta->idSaldoCuenta->CellCssClass = "";
  1097. // idCuenta
  1098. $saldo_cuenta->idCuenta->CellCssStyle = "";
  1099. $saldo_cuenta->idCuenta->CellCssClass = "";
  1100. // fecha
  1101. $saldo_cuenta->fecha->CellCssStyle = "";
  1102. $saldo_cuenta->fecha->CellCssClass = "";
  1103. // nro_fact_recibo
  1104. $saldo_cuenta->nro_fact_recibo->CellCssStyle = "";
  1105. $saldo_cuenta->nro_fact_recibo->CellCssClass = "";
  1106. // detalle
  1107. $saldo_cuenta->detalle->CellCssStyle = "";
  1108. $saldo_cuenta->detalle->CellCssClass = "";
  1109. // ingreso
  1110. $saldo_cuenta->ingreso->CellCssStyle = "";
  1111. $saldo_cuenta->ingreso->CellCssClass = "";
  1112. // egreso
  1113. $saldo_cuenta->egreso->CellCssStyle = "";
  1114. $saldo_cuenta->egreso->CellCssClass = "";
  1115. if ($saldo_cuenta->RowType == EW_ROWTYPE_VIEW) { // View row
  1116. // idSaldoCuenta
  1117. $saldo_cuenta->idSaldoCuenta->ViewValue = $saldo_cuenta->idSaldoCuenta->CurrentValue;
  1118. $saldo_cuenta->idSaldoCuenta->CssStyle = "";
  1119. $saldo_cuenta->idSaldoCuenta->CssClass = "";
  1120. $saldo_cuenta->idSaldoCuenta->ViewCustomAttributes = "";
  1121. // idCuenta
  1122. if (strval

Large files files are truncated, but you can click here to view the full file