Odyssey
invoiceView.prg
1 <?php
2 /* File: monthReport.html
3  * Purpose: provides a simple report for a month without any fluff introduced by Kendo. You cannot do anything with this besides view it.
4  */
5 ?>
6 
7 <script type="text/javascript">
8 
9 <?php
10 // Get common JS functions here.
11 getShowWaitFunctions();
12 ?>
13 
14 <?php
15 /**
16  * function initInvoiceView()
17  * Initalizes them invoice views
18  */
19 ?>
20 function InitInvoiceView() {
21  $.homecuValidator.setup({formValidate: "invoiceForm", formStatusField: "invoiceFormStatus"});
22  var bottomGrid = $("#bottomGrid").kendoGrid({
23  dataSource: {
24  transport: {
25  read: {
26  url: "index.prg?operation=cuView&cu=<?php echo $SYSENV["BILL"]["cu"]; ?>",
27  dataType: "json",
28  type: "POST"
29  },
30  parameterMap: function(data, type) {
31  showWaitWindow();
32  return {};
33  }
34  },
35  schema: {
36  model: {
37  id: "templateId",
38  fields: {
39  templateId: {type: "number"},
40  textDescription: {type: "string"},
41  statusLabel: {type: "string"},
42  billHalf: {type: "boolean"},
43  initialCosts: {type: "string"},
44  recurringCosts: {type: "string"}
45  }
46  },
47  parse: function (data) {
48  hideWaitWindow();
49  if (data.status !== "000") {
50  $.homecuValidator.displayMessage(data.error, $.homecuValidator.settings.statusError );
51  return [];
52  } else {
53  InitTop(data.top);
54  return data.bottom;
55  }
56  }
57  },
58  group: {field: "billingStatusGroup"}
59  },
60  columns: [
61  {title: ""},
62  {field: "billingStatusGroup", hidden: true,
63  groupHeaderTemplate: "# if (value == 0) { # Active: # } else if (value == 1) { # Pending: # } else { # Completed: # } #"}
64  ],
65  rowTemplate: kendo.template($("#rowTemplate").html()),
66  altRowTemplate: kendo.template($("#altRowTemplate").html()),
67  dataBound: function (e) {
68  $("#bottomGrid .k-grid-header").remove();
69 
70  $("#bottomGrid .k-grouping-row").each(function () {
71  $(this).after($("#headerRowTemplate").html());
72  $(this).prev().find("td").css({borderBottom: "1px solid black"});
73  $(this).next().find("td").css({borderTop: "1px solid black"});
74  });
75 
76  $("#bottomGrid .k-grouping-row td").each(function () {
77  $(this).text($(this).text()); // Removes the p and k-reset elements
78  });
79  }
80  }).data("kendoGrid");
81 }
82 
83 <?php
84 /**
85  * function initTop(topData)
86  * Initializes the top
87  *
88  * @param array topData -- the data for the top grid.
89  */
90 ?>
91 function InitTop(topData) {
92  var topGrid = $("#topGrid").kendoGrid({
93  dataSource: {
94  data: topData,
95  schema: {
96  model: {
97  id: "cu",
98  fields: {
99  cu: {type: "string"},
100  cuName: {type: "string"},
101  type: {type: "string"},
102  closed: {type: "boolean"}
103  }
104  }
105  }
106  },
107  rowTemplate: kendo.template($("#topRowTemplate").html()),
108  dataBound: function (e) {
109  $("#topGrid .k-grid-header").remove();
110  $("#topGrid colgroup").remove();
111  }
112  }).data("kendoGrid");
113 }
114 
115 $(document).ready(function () {
116  InitInvoiceView();
117 });
118 </script>
119 
120 <script id="topRowTemplate" type="text/k-kendo-template">
121 <tr class="header">
122  <td>CU</td>
123  <td>CU Name</td>
124  <td>Type</td>
125  <td>Closed</td>
126 </tr>
127 <tr data-uid="#: uid #">
128  <td>#: cu #</td>
129  <td>#: cuName #</td>
130  <td>#: type #</td>
131  <td># if (closed) { # Yes # } else { # No # } #</td>
132 </tr>
133 </script>
134 <script id="headerRowTemplate" type="text/k-kendo-template">
135  <tr class="header">
136  <td colspan="2">
137  <div class="grid_12">
138  <div class="grid_4 alpha">Item Name</div>
139  <div class="grid_1">Split</div>
140  <div class="grid_2">Status</div>
141  <div class="grid_2">Initial</div>
142  <div class="grid_3 omega">Recurring</div>
143  </div>
144  </td>
145  </tr>
146 </script>
147 <script id="rowTemplate" type="text/x-kendo-template">
148  <tr class="normalRow" data-uid="#= uid #">
149  <td colspan="2">
150  <div class="grid_12">
151  <div class="grid_4 alpha"># if (salesItemDescr == "") { # &nbsp; # } else { # #: salesItemDescr # # } #</div>
152  <div class="grid_1"># if (billHalf) { # Yes # } else { # No # } #</div>
153  <div class="grid_2"># if (statusLabel == "") { # &nbsp; # } else { # #: statusLabel # # } #</div>
154  <div class="grid_2"># if (initialCosts == "") { # &nbsp; # } else { # #: initialCosts # # } #</div>
155  <div class="grid_3 omega"># if (recurringCosts == "") { # &nbsp; # } else { # #: recurringCosts # # } #</div>
156  </div>
157  <div class="grid_12" style="margin: 15px;"><span class="descriptionSpan"><b>Description: </b> &nbsp; #: textDescription #</span></div>
158  </td>
159  </tr>
160 </script>
161 <script id="altRowTemplate" type="text/x-kendo-template">
162  <tr class="k-alt normalRow" data-uid="#= uid #">
163  <td colspan="2">
164  <div class="grid_12">
165  <div class="grid_4 alpha"># if (salesItemDescr == "") { # &nbsp; # } else { # #: salesItemDescr # # } #</div>
166  <div class="grid_1"># if (billHalf) { # Yes # } else { # No # } #</div>
167  <div class="grid_2"># if (statusLabel == "") { # &nbsp; # } else { # #: statusLabel # # } #</div>
168  <div class="grid_2"># if (initialCosts == "") { # &nbsp; # } else { # #: initialCosts # # } #</div>
169  <div class="grid_3 omega"># if (recurringCosts == "") { # &nbsp; # } else { # #: recurringCosts # # } #</div>
170  </div>
171  <div class="grid_12" style="margin: 15px;"><span class="descriptionSpan"><b>Description: </b> &nbsp; #: textDescription #</span></div>
172  </td>
173  </tr>
174 </script>
175 <div class="container_12" id="invoiceForm">
176  <div id="invoiceFormStatus"></div>
177  <div class="grid_12">
178  <div id="topGrid" class="cuIndexGrid"></div>
179  </div>
180  <div class="grid_12">
181  &nbsp;
182  </div>
183 
184  <div class="grid_12">
185  <div id="bottomGrid" class="cuIndexGrid"></div>
186  </div>
187 </div>