Odyssey
configuration.i
1 <?php
2 /* File: configuration.php
3  * Purpose: contains arrays of literals for labels and for defining automatic adds.
4  */
5 
6 /**
7  * function GetWorkflowOptions()
8  * Gets the options for the workflow dropdownlist.
9  * Instead of numbers, use strings for clarity.
10  * If workflow is not appropriate for the product/line item, then the value is "none."
11  */
12 function GetWorkflowOptions() {
13 
14  return array (
15  array("text" => "Create Job", "value" => "create"),
16  array("text" => "Associate Existing Job...", "value" => "associate"),
17  array("text" => "Bill Without Job", "value" => "without")
18  );
19 }
20 
21 /**
22  * function GetMonthOptions()
23  * Gets a list of months for the frequency dropdownlist.
24  * Value corresponds to the bit to set in the bills on field.
25  */
26 function GetMonthOptions() {
27  return array(
28  array("value" => 0, "text" => "January"),
29  array("value" => 1, "text" => "February"),
30  array("value" => 2, "text" => "March"),
31  array("value" => 3, "text" => "April"),
32  array("value" => 4, "text" => "May"),
33  array("value" => 5, "text" => "June"),
34  array("value" => 6, "text" => "July"),
35  array("value" => 7, "text" => "August"),
36  array("value" => 8, "text" => "September"),
37  array("value" => 9, "text" => "October"),
38  array("value" => 10, "text" => "November"),
39  array("value" => 11, "text" => "December")
40  );
41 }
42 
43 /**
44  * function GetFrequencyOptions()
45  * Gets the options for the frequency dropdownlist.
46  */
47 function GetFrequencyOptions() {
48  return array(
49  array("value" => 0, "text" => "Monthly"),
50  array("value" => 1, "text" => "Semiyearly"),
51  array("value" => 2, "text" => "Yearly")
52  );
53 }
54 
55 /**
56  * function GetBillingItems()
57  * This list is the sales items from the Accounting system and a description that could make more sense.
58  * ***** NOTE: "Timetrack" doesn't actually refer to a billing item in QB.
59  * During processing, there will be items for Elaine, Jayme, etc. for the billing and rush hours.
60  */
61 function GetBillingItems() {
62  return array( "Android" => "Android App Monthly Fee",
63  "AndroidSetup" => "Android App Setup Fee",
64  "CkImaging" => "Check Imaging Monthly Fee",
65  "CkSetup" => "Check Imaging Setup Fee",
66  "E2stmnt" => "E-Statements Tier Two",
67  "E3stmnt" => "E-Statements Tier Three",
68  "Email" => "Email Account",
69  "Estmnt" => "E-Statements Tier One",
70  "HBBatch" => "Home Banking Batch Monthly Fee",
71  "HBBatchSetup" => "Home Banking Batch Setup Fee",
72  "HBLive" => "Home Banking Live Monthly Fee",
73  "HBLiveSetup" => "Home Banking Live Setup Fee",
74  "HBUpgrade" => "Home Banking Desktop Upgrade",
75  "iPhone" => "iPhone App Monthly Fee",
76  "iPhoneSetup" => "iPhone App Setup Fee",
77  "IVR" => "IVR Monthly Fee",
78  "IVRSetup" => "IVR Setup",
79  "IVRUsage" => "IVR Monthly Usage - Per Minute",
80  "MWeb" => "Mobile Web Banking Monthly Fee",
81  "MWebSetup" => "Mobile Web Banking Setup Fee",
82  "PEmail" => "Premium Email Account",
83  "RDC" => "RDC Base Monthly Fee",
84  "RDCSetup" => "RDC Setup Fee",
85  "Secure" => "Secure Forms Monthly Hosting",
86  "SecureSetup" => "Secure Forms Setup Fee",
87  "SSL" => "SSL Certificate Monthly Hosting",
88  "SSLSetup" => "SSL Certificate Setup",
89  "SunsetWEB" => "HB Sunset Monthly Service Fee",
90  "TXT" => "TXT Banking Monthly Fee",
91  "TXTSetup" => "TXT Banking Setup Fee",
92  "WEB" => "Home Banking Monthly Service Fee",
93  "WebSetup" => "Website Development Setup",
94  "Timetrack" => "HTML/Support",
95  "EstmntSetup" => "E-Statement Setup",
96  "BillPaySetup" => "Bill-Pay Setup",
97  "Loan" => "Member Loan Approval",
98  "LoanSetup" => "Member Loan Approval Setup",
99  "SSLCert" => "SSL Certificate Purchase",
100  "Gold" => "Gold Monthly",
101  "GoldSetup" => "Gold Setup",
102  "Silver" => "Silver Monthly",
103  "SilverSetup" => "Silver Setup",
104  "Platinum" => "Platinum Monthly",
105  "PlatinumSetup" => "Platinum Setup",
106  "Intuit" => "Intuit Monthly",
107  "IntuitSetup" => "Intuit Setup",
108  "BillPay" => "Bill-Pay Monthly"
109  );
110 }
111 
112 /**
113  * function GetTimetrackBillingItems()
114  * For matching case sensitivity and adding hours label on the count.
115  */
116 function GetTimetrackBillingItems() {
117  return array("cerise" => "HTML/Support",
118  "elaine" => "HTML/Support",
119  "gary" => "Gary Peters Programming Services",
120  "jayme" => "HTML/Graphics Design",
121  "joe" => "Joe Pearson Consulting Services",
122  "kim" => "Kim Langdon Programming Services",
123  "mark" => "Mark Stevens Programming Services",
124  "miki" => "Miki Hall Programming Services",
125  "test" => "TEST HTML/Support",
126  "tyler" => "HTML/Support",
127  "buddy" => "HTML/Support",
128  "nick" => "HTML/Support",
129  "lisa" => "HTML/Support",
130  "matt" => "HTML/Support");
131 }
132 
133 // GetSetupRecurring() ... getFixedVariableLabels(): configuration options for feature details (salesOrderDetail bottom level).
134 
135 /**
136  * GetSetupRecurring()
137  * "setup" --
138  * End date, Variable, qty1, and qty2 fields will be hidden.
139  * Any changes to the start date will set the end date to the same value.
140  * "recurring" --
141  * End date is visible. Variable, qty1, and qty2's visibility can be restricted on a different configuration.
142  * "triggered" --
143  * Functions like a setup. However, feature is active when a workflow task is completed.
144  * Only real example of this is the SSL certificate.
145  */
146 function GetSetupRecurring() {
147  return array ( "Android" => "recurring",
148  "AndroidSetup" => "setup",
149  "CkImaging" => "recurring",
150  "CkSetup" => "setup",
151  "E2stmnt" => "recurring",
152  "E3stmnt" => "recurring",
153  "Email" => "recurring",
154  "Estmnt" => "recurring",
155  "HBBatch" => "recurring",
156  "HBBatchSetup" => "setup",
157  "HBLive" => "recurring",
158  "HBLiveSetup" => "setup",
159  "HBUpgrade" => "recurring",
160  "iPhone" => "recurring",
161  "iPhoneSetup" => "setup",
162  "IVR" => "recurring",
163  "IVRSetup" => "setup",
164  "IVRUsage" => "recurring",
165  "MWeb" => "recurring",
166  "MWebSetup" => "setup",
167  "PEmail" => "recurring",
168  "RDC" => "recurring",
169  "RDCSetup" => "setup",
170  "Secure" => "recurring",
171  "SecureSetup" => "setup",
172  "SSL" => "recurring",
173  "SSLSetup" => "setup",
174  "SunsetWEB" => "recurring",
175  "TXT" => "recurring",
176  "TXTSetup" => "setup",
177  "WEB" => "recurring",
178  "WebSetup" => "setup",
179  "Timetrack" => "recurring",
180  "HBUpgrade" => "setup",
181  "EstmntSetup" => "setup",
182  "BillPaySetup" => "setup",
183  "LoanSetup" => "setup",
184  "Loan" => "recurring",
185  "SSLCert" => "triggered",
186  "TestSetup" => "setup",
187  "Test" => "recurring",
188  "TestCert" => "triggered",
189  "Gold" => "recurring",
190  "Platinum" => "recurring",
191  "Silver" => "recurring",
192  "GoldSetup" => "setup",
193  "PlatinumSetup" => "setup",
194  "SilverSetup" => "setup",
195  "Intuit" => "recurring",
196  "IntuitSetup" => "setup",
197  "BillPay" => "recurring"
198  );
199 }
200 
201 /**
202  * function GetFullLabelTypes()
203  * This is a list of options that a line item can have for quantity labels.
204  */
205 function GetFullLabelTypes() {
206  return array ("regular", "range", "left", "left and right", "none", "no qty1", "no qty2");
207 }
208 
209 /**
210  * function GetQuantityLabelTypeVariance()
211  * List of billing system ids that change by the sales item id.
212  */
213 function GetQuantityLabelTypeVariance() {
214  return array ( "SunsetWEB" => array("37" => "no qty2", "67" => "left and right", "69" => "left and right"),
215  "Estmnt" => array("107" => "none"),
216  "IVRUsage" => array("108" => "no qty2", "109" => "no qty2"),
217  "SSL" => array("123" => "none", "128" => "no qty2"),
218  "Secure" => array("129" => "no qty2"),
219  "RDC" => array("124" => "left and right")
220  );
221 }
222 
223 /**
224  * function GetQuantityLabelType()
225  * List of billing system ids and the label type.
226  */
227 function GetQuantityLabelType() {
228  return array ( "Android" => "left and right",
229  "E2stmnt" => "range",
230  "E3stmnt" => "range",
231  "Email" => "none",
232  "Estmnt" => "range",
233  "HBLive" => "left and right",
234  "iPhone" => "left and right",
235  "PEmail" => "none",
236  "Timetrack" => "none",
237  "SSL" => "range",
238  "IVRUsage" => "none",
239  "HBBatch" => "left and right",
240  "MWeb" => "left and right",
241  "CkImaging" => "none",
242  "IVR" => "none",
243  "RDC" => "none",
244  "Secure" => "none",
245  "TXT" => "none",
246  "WEB" => "none",
247  "Loan" => "left and right",
248  "Gold" => "none",
249  "Silver" => "none",
250  "Platinum" => "none",
251  "Intuit" => "none",
252  "BillPay" => "none"
253  );
254 }
255 
256 /**
257  * function GetQuantityLabelsVariance()
258  * The labels by sales item id for the billing system ids.
259  */
260 function GetQuantityLabelsVariance() {
261  return array ( "SunsetWEB" => array("37" => array("If less than:", "Members")),
262  "IVRUsage" => array("108" => array("Up to:", "Minutes"), "109" => array("After:", "Minutes")),
263  "SSL" => array("128" => array("", "Members")),
264  "Secure" => array("129" => array("", "Members")));
265 }
266 
267 /**
268  * function GetQuantityLabels()
269  * The labels by billing system id.
270  */
271 function GetQuantityLabels() {
272  return array ( "Android" => array("For each", "Members", "Over", ""),
273  "RDC" => array("For each", "Members", "Over", ""),
274  "E2stmnt" => array("Estatements:"),
275  "E3stmnt" => array("Estatements:"),
276  "Estmnt" => array("Estatements:"),
277  "HBBatch" => array("For each", "Members", "Over", ""),
278  "HBLive" => array("For each", "Members", "Over", ""),
279  "iPhone" => array("For each", "Members", "Over", ""),
280  "MWeb" => array("For each", "Members", "Over", ""),
281  "Loan" => array("For each", "Members", "Over", ""),
282  "SSL" => array("Assets:"),
283  "SunsetWEB" => array("For each", "Members", "Over", "")
284  );
285 }
286 
287 /**
288  * function GetFixedVariableLabelTypeVariance()
289  * The fixed, variable label types by sales item id for billing system ids.
290  */
291 function GetFixedVariableLabelTypeVariance() {
292  return array("Email" => array("11" => "none", "84" => "no variable"),
293  "SunsetWEB" => array("37" => "no fixed"),
294  "Estmnt" => array("107" => "no variable"),
295  "IVRUsage" => array("109" => "no fixed"),
296  "CkImaging" => array("7" => "no variable", "125" => "no fixed"),
297  "RDC" => array("47" => "no variable", "124" => "regular"),
298  "Secure" => array("63" => "no variable", "127" => "no fixed", "129" => "regular"),
299  "WEB" => array("51" => "no variable", "126" => "no fixed"),
300  "SSL" => array("123" => "no fixed", "128" => "regular"),
301  "Gold" => array("113" => "no fixed", "120" => "no variable"),
302  "Platinum" => array("117" => "no fixed", "121" => "no variable"),
303  "Silver" => array("115" => "no fixed", "122" => "no variable"),
304  "BillPay" => array("135" => "no variable", "136" => "no variable"));
305 }
306 
307 /**
308  * function GetFixedVariableLabelType()
309  * The fixed, variable label types by billing system id.
310  */
311 function GetFixedVariableLabelType() {
312  return array("Timetrack" => "left",
313  "PEmail" => "none",
314  "SSL" => "no variable",
315  "Estmnt" => "no fixed",
316  "E2stmnt" => "no fixed",
317  "E3stmnt" => "no fixed",
318  "IVR" => "no variable",
319  "TXT" => "no variable",
320  "IVRUsage" => "left",
321  "Intuit" => "no variable",
322  "BillPay" => "no fixed",
323  "RDC" => "regular"
324  );
325 }
326 
327 /**
328  * function GetFixedVariableLabelsVariance()
329  * The fixed, variable labels by sales item id for billing system ids.
330  */
331 function GetFixedVariableLabelsVariance() {
332  return array("IVRUsage" => array("21" => array("Base:", "Per Call:"), "109" => array("Per Minute:")),
333  "Estmnt" => array("3" => array("Per Statement:"), "83" => array("Per Statement:"), "82" => array("Per Statement:")),
334  "CkImaging" => array("125" => array("If less than or equal to:", "If greater than:")),
335  "Secure" => array("127" => array("Per Member:"), "129" => array("If less than or equal to:", "If greater than:")),
336  "SSL" => array("123" => array("Per Member:")),
337  "Gold" => array("113" => array("Per Member:")),
338  "Silver" => array("115" => array("Per Member:")),
339  "Platinum" => array("117" => array("Per Member:")),
340  "SSL" => array("128" => array("If less than or equal to:", "If greater than:")),
341  "BillPay" => array("137" => array("Per Transaction Fee:"), "138" => array("Per stop and reissue fee:"), "139" => array("Per letter mailed express mail:"),
342  "140" => array("Per NSF fee:"), "141" => array("Per proof of payment:"))
343  );
344 }
345 
346 /**
347  * function GetFixedVariableLabels()
348  * The fixed, variable labels by billing system id.
349  */
350 function GetFixedVariableLabels() {
351  return array("Timetrack" => array("Bill Rate:", "Rush Rate:"),
352  "E2stmnt" => array("Per Statement:"),
353  "E3stmnt" => array("Per Statement:"),
354  "IVRUsage" => array("Base:", "Per Minute:"),
355  "RDC" => array("Fixed:", "Variable:")
356  );
357 }
358 
359 /**
360  * function GetAutomaticProductAddConfigOptions()
361  * controls dropdown menus on salesOrderDetail adds (top level).
362  * If there isn't one for the product, it will be added immediately.
363  */
364 function GetAutomaticProductAddConfigOptions() {
365  return array( "HBLive" => array("HBLive1" => "Regular", "HBLive2" => "With Sunset"),
366  "HBBatch" => array("HBBatch1" => "Regular", "HBBatch2" => "With Sunset"),
367  "IVR VOIP" => array("IVR VOIP1" => "Per Minute", "IVR VOIP2" => "Per Call", "IVR VOIP3" => "Tiered Minutes"),
368  "ESP" => array("ESP1" => "Tiered", "ESP2" => "Fixed per count", "ESP4" => "Fixed Rate", "ESP3" => "Free"),
369  "Gold" => array("Gold1" => "Regular Pricing", "Gold2" => "Small Credit Unions"),
370  "Platinum" => array("Platinum1" => "Regular Pricing", "Platinum2" => "Small Credit Unions"),
371  "Silver" => array("Silver1" => "Regular Pricing", "Silver2" => "Small Credit Unions"),
372  "WEBS" => array("WEBS1" => "Fixed Rate", "WEBS2" => "Based on membership"),
373  "SSL" => array("SSL1" => "Per Member", "SSL2" => "Flat on membership size"),
374  "SecForm" => array("SecForm1" => "Per Member", "SecForm2" => "Flat on membership size"),
375  "BP" => array("BP1" => "Setup only", "BP2" => "iPay"),
376  "RDC" => array("RDC1" => "Flat Fee", "RDC2" => "Based on membership"));
377 }
378 
379 /**
380  * function GetUseDNID()
381  * @return list of billing system ids that use the long code.
382  */
383 function GetUseDNID() {
384  return array("IVRUsage" => true);
385 }
386 
387 /**
388  * function GetUseDNIDProduct()
389  * @return list of product ids that use the long code.
390  */
391 function GetUseDNIDProduct() {
392  return array("IVR VOIP" => true);
393 }
394 
395 /**
396  * function GetSaveDigits()
397  * This controls how many digits can be saved for fixed and variable values.
398  * If not set, digits default to 2.
399  */
400 function GetSaveDigits() {
401  return array("IVRUsage" => 3, "Gold" => 3, "Platinum" => 3, "Silver" => 3);
402 }
403 
404 /**
405  * function GetAutomaticProductAdds()
406  * @return list of product features whether chosen from the ddl or directly added.
407  */
408 function GetAutomaticProductAdds() {
409  $returnArray = array ( "ESP1" => array(array("billingId" => "EstmntSetup", "salesItemId" => 101),
410  array( "billingId" => "Estmnt", "salesItemId" => 3),
411  array( "billingId" => "E2stmnt", "salesItemId" => 5),
412  array( "billingId" => "E3stmnt", "salesItemId" => 23)),
413  "ESP2" => array(array("billingId" => "EstmntSetup", "salesItemId" => 101),
414  array("billingId" => "Estmnt", "salesItemId" => 82)),
415  "ESP3" => array(array("billingId" => "EstmntSetup", "salesItemId" => 101),
416  array("billingId" => "Estmnt", "salesItemId" => 83)),
417  "ESP4" => array(array("billingId" => "EstmntSetup", "salesItemId" => 101),
418  array("billingId" => "Estmnt", "salesItemId" => 107)),
419  "HBBatch1" => array(array("billingId" => "HBBatchSetup", "salesItemId" => 31),
420  array("billingId" => "HBBatch", "salesItemId" => 2)),
421  "HBLive1" => array(array("billingId" => "HBLiveSetup", "salesItemId" => 35),
422  array("billingId" => "HBLive", "salesItemId" => 33)),
423  "HBBatch2" => array(array("billingId" => "HBBatchSetup", "salesItemId" => 31),
424  array("billingId" => "SunsetWEB", "salesItemId" => 37),
425  array("billingId" => "SunsetWEB", "salesItemId" => 67)),
426  "HBLive2" => array(array("billingId" => "HBLiveSetup", "salesItemId" => 35),
427  array("billingId" => "SunsetWEB", "salesItemId" => 69)),
428  "UpgradeBL" => array(array("billingId" => "HBUpgrade", "salesItemId" => 91)),
429  "IMG" => array(array( "billingId" => "CkSetup", "salesItemId" => 41),
430  array( "billingId" => "CkImaging", "salesItemId" => 7)),
431  "IVR" => array(array( "billingId" => "IVRSetup", "salesItemId" => 39),
432  array( "billingId" => "IVR", "salesItemId" => 17)),
433  "MBLADA" => array(array("billingId" => "AndroidSetup", "salesItemId" => 1),
434  array("billingId" => "Android", "salesItemId" => 4)),
435  "MBLAPP" => array(array("billingId" => "iPhoneSetup", "salesItemId" => 15),
436  array("billingId" => "iPhone", "salesItemId" => 13)),
437  "MBLTXT" => array(array("billingId" => "TXTSetup", "salesItemId" => 29),
438  array("billingId" => "TXT", "salesItemId" => 27)),
439  "MBLWEB" => array(array("billingId" => "MWebSetup", "salesItemId" => 45),
440  array("billingId" => "MWeb", "salesItemId" => 43)),
441  "RDC1" => array(array( "billingId" => "RDCSetup", "salesItemId" => 49),
442  array( "billingId" => "RDC", "salesItemId" => 47)),
443  "RDC2" => array(array( "billingId" => "RDCSetup", "salesItemId" => 49),
444  array( "billingId" => "RDC", "salesItemId" => 124)),
445  "SSL1" => array(array( "billingId" => "SSLSetup", "salesItemId" => 59),
446  array( "billingId" => "SSL", "salesItemId" => 123),
447  array( "billingId" => "SSL", "salesItemId" => 106)),
448  "SSL2" => array(array( "billingId" => "SSLSetup", "salesItemId" => 59),
449  array( "billingId" => "SSL", "salesItemId" => 128),
450  array( "billingId" => "SSL", "salesItemId" => 106)),
451  "SecForm1" => array(array("billingId" => "SecureSetup", "salesItemId" => 61),
452  array("billingId" => "Secure", "salesItemId" => 127)),
453  "SecForm2" => array(array("billingId" => "SecureSetup", "salesItemId" => 61),
454  array("billingId" => "Secure", "salesItemId" => 129)),
455  "WEBS1" => array(array( "billingId" => "WebSetup", "salesItemId" => 53),
456  array( "billingId" => "WEB", "salesItemId" => 51)),
457  "WEBS2" => array(array( "billingId" => "WebSetup", "salesItemId" => 53),
458  array( "billingId" => "WEB", "salesItemId" => 126)),
459  "IVR VOIP1" => array(array("billingId" => "IVRSetup", "salesItemId" => 70),
460  array("billingId" => "IVRUsage", "salesItemId" => 19)),
461  "IVR VOIP2" => array(array("billingId" => "IVRSetup", "salesItemId" => 70),
462  array("billingId" => "IVRUsage", "salesItemId" => 21)),
463  "IVR VOIP3" => array(array("billingId" => "IVRSetup", "salesItemId" => 70),
464  array("billingId" => "IVRUsage", "salesItemId" => 108),
465  array("billingId" => "IVRUsage", "salesItemId" => 109)),
466  "Email" => array(array("billingId" => "Email", "salesItemId" => 11),
467  array("billingId" => "PEmail", "salesItemId" => 55)),
468  "BP1" => array(array("billingId" => "BillPaySetup", "salesItemId" => 99)),
469  "BP2" => array(array("billingId" => "BillPaySetup", "salesItemId" => 134), // Consumer Bill Pay
470  array("billingId" => "BillPay", "salesItemId" => 135), // Minimum Monthly Volume
471  array("billingId" => "BillPay", "salesItemId" => 136), // Annual Compliance Package
472  array("billingId" => "BillPay", "salesItemId" => 137), // Per Transaction Fee
473  array("billingId" => "BillPay", "salesItemId" => 138), // Per stop and reissue fee
474  array("billingId" => "BillPay", "salesItemId" => 139), // Per letter mailed express mail
475  array("billingId" => "BillPay", "salesItemId" => 140), // per NSF fee
476  array("billingId" => "BillPay", "salesItemId" => 141)), // standard proof of payment request
477  "MBLLNAPP" => array(array("billingId" => "LoanSetup", "salesItemId" => 105),
478  array("billingId" => "Loan", "salesItemId" => 104)),
479  "Gold1" => array(array("billingId" => "GoldSetup", "salesItemId" => 114),
480  array("billingId" => "Gold", "salesItemId" => 113)),
481  "Silver1" => array(array("billingId" => "SilverSetup", "salesItemId" => 116),
482  array("billingId" => "Silver", "salesItemId" => 115)),
483  "Platinum1" => array(array("billingId" => "PlatinumSetup", "salesItemId" => 118),
484  array("billingId" => "Platinum", "salesItemId" => 117)),
485  "Gold2" => array(array("billingId" => "GoldSetup", "salesItemId" => 114),
486  array("billingId" => "Gold", "salesItemId" => 120)),
487  "Silver2" => array(array("billingId" => "SilverSetup", "salesItemId" => 116),
488  array("billingId" => "Silver", "salesItemId" => 122)),
489  "Platinum2" => array(array("billingId" => "PlatinumSetup", "salesItemId" => 118),
490  array("billingId" => "Platinum", "salesItemId" => 121)),
491  "Intuit" => array(array("billingId" => "IntuitSetup", "salesItemId" => 132),
492  array("billingId" => "Intuit", "salesItemId" => 133))
493  );
494  return $returnArray;
495 }
496 
497 /**
498  * function GetNeedsOverlapCheck()
499  * @return $check -- list of products to check if there is an overlap.
500  * @return $not -- don't include these sales item ids when checking.
501  */
502 function GetNeedsOverlapCheck() {
503  return array("check" => array("ESP"), "not" => array(123, 107, 82, 83));
504 }
505 
506 /**
507  * function GetCountLabelVariance()
508  * Labels on the monthly billing page for the count column (by sales item id for billing system ids)
509  */
510 function GetCountLabelVariance() {
511  return array( "SunsetWEB" => array("67" => "Members", "37" => "Members", "69" => "Fee(s)"),
512  "Estmnt" => array("83" => "Fee(s)", "82" => "E-Statements", "3" => "E-Statements", "107" => "Fee(s)"),
513  "IVRUsage" => array("21" => "Calls"),
514  "Email" => array("11" => "Accounts", "84" => "Credit"),
515  "CkImaging" => array("125" => "Fee (s)"),
516  "RDC" => array("124" => "Fee (s)"),
517  "Secure" => array("127" => "Members", "129" => "Flat Fee"),
518  "WEB" => array("126" => "Members"),
519  "SSL" => array("123" => "Members", "128" => "Flat Fee"),
520  "Gold" => array("120" => "Flat Fee", "113" => "Members"),
521  "Silver" => array("122" => "Flat Fee", "115" => "Members"),
522  "Platinum" => array("121" => "Flat Fee", "117" => "Members"),
523  "SecForm" => array("129" => "Flat Fee"),
524  "BillPay" => array("135" => "Flat Fee", "136" => "Flat Fee (annual)", "137" => "Transactions",
525  "138" => "Stop and reissues", "139" => "Express mail", "140" => "NSFs",
526  "141" => "Proof of payments")
527  );
528 }
529 
530 /**
531  * function GetCountLabels()
532  * Labels on the monthly billing page for the count column (by billing system id)
533  *
534  * **NOTE**: Timetrack will show as "Hours (<name>)". Controlled by the getTimetrackBillingItems() array.
535  */
536 function GetCountLabels() {
537  return array( "Android" => "Fee(s)",
538  "AndroidSetup" => "Setup",
539  "CkImaging" => "Flat Fee",
540  "CkSetup" => "Setup",
541  "E2stmnt" => "E-Statements",
542  "E3stmnt" => "E-Statements",
543  "HBBatch" => "Fee(s)",
544  "HBBatchSetup" => "Setup",
545  "HBLive" => "Fee(s)",
546  "HBLiveSetup" => "Setup",
547  "HBUpgrade" => "Fee(s)",
548  "iPhone" => "Fee(s)",
549  "iPhoneSetup" => "Setup",
550  "IVR" => "Fee(s)",
551  "IVRSetup" => "Setup",
552  "MWeb" => "Fee(s)",
553  "MWebSetup" => "Setup",
554  "PEmail" => "Accounts",
555  "RDC" => "Flat Fee",
556  "RDCSetup" => "Setup",
557  "Secure" => "Flat Fee",
558  "SecureSetup" => "Setup",
559  "SSL" => "Conditional Fee(s)",
560  "SSLSetup" => "Setup",
561  "TXT" => "Fee(s)",
562  "TXTSetup" => "Setup",
563  "WEB" => "Flat Fee",
564  "WebSetup" => "Setup",
565  "BillPaySetup" => "Setup",
566  "EstmntSetup" => "Setup",
567  "LoanSetup" => "Setup",
568  "Loan" => "Fee(s)",
569  "SSLCert" => "Fee",
570  "IVRUsage" => "Minutes",
571  "GoldSetup" => "Setup",
572  "SilverSetup" => "Setup",
573  "PlatinumSetup" => "Setup",
574  "IntuitSetup" => "Setup",
575  "Intuit" => "Flat Fee"
576  );
577 }
578 
579 /**
580  * function GetTextDescription($salesItemId, $billingId, $fixed, $variable, $qty1, $qty2, $aDNID)
581  * This gives a concise description of the line item.
582  * The current values in the line item will be used in the description.
583  *
584  * @param $salesItemId -- Number of the sales item the line item corresponds to.
585  * @param $billingId -- String of the particular billingId.
586  * @param $fixed -- Number of the fixed amount.
587  * @param $variable -- Number of the variable amount.
588  * @param $qty1 -- Number of the first quantity.
589  * @param $qty2 -- Number of the second quantity.
590  * @param $aDNID -- The long code number.
591  *
592  * @return String -- the full English description.
593  */
594 function GetTextDescription($salesItemId, $billingId, $fixed, $variable, $qty1, $qty2, $aDNID) {
595  $formattedQty1 = number_format($qty1);
596  $formattedQty2 = number_format($qty2);
597 
598  $saveDigits = GetSaveDigits();
599  $digits = HCU_array_key_value($billingId, $saveDigits);
600  $digits = $digits === false ? 2 : intval($digits);
601 
602  $formattedFixed = $fixed < 0 ? "$(" . number_format(abs($fixed), $digits) . ")" : "$" . number_format($fixed, $digits);
603  $formattedVariable = $variable < 0 ? "$(" . number_format(abs($variable), $digits) . ")" : "$" . number_format($variable, $digits);
604 
605  $flatSunsetRate = $fixed == 0 ? "" : "a flat fee of $formattedFixed per month then";
606  $flatRate = $fixed == 0 ? "" : "$formattedFixed per mo. plus";
607  $over = $qty2 == 0 ? "" : " over $formattedQty2";
608  $variableSunsetText = "$formattedQty1 to $formattedQty2 total membership $flatRate $formattedVariable per mo. "
609  . "for each $formattedQty1 members (or portion thereof)${over}.";
610  $variableText = "$flatRate $formattedVariable per mo. for each $formattedQty1 members (or portion thereof)${over}.";
611  $fixedText = "Fixed fee of $formattedFixed.";
612 
613  switch ($billingId) {
614  case "E2stmnt": return "E-Statements $formattedVariable each $formattedQty1 to $formattedQty2 members.";
615  case "E3stmnt": return "E-Statements $formattedVariable after $formattedQty1 members.";
616  case "Estmnt":
617  if ($salesItemId == 3) {
618  return "E-Statements $formattedVariable per the first $formattedQty2 members.";
619  } else if ($salesItemId == 82) {
620  return "$formattedVariable per E-Statement.";
621  } else if ($salesItemId == 83) {
622  return "Free E-Statements.";
623  } else if ($salesItemId == 107) {
624  return "Monthly fee of $formattedFixed";
625  } else {
626  return "";
627  }
628  case "SunsetWEB":
629  if ($salesItemId == 37) {
630  return "Fewer than $formattedQty1 total membership $formattedVariable per member per month.";
631  } else if ($salesItemId == 67) {
632  return $variableSunsetText;
633  } else if ($salesItemId == 69) {
634  return $variableText;
635  } else {
636  return "";
637  }
638  case "AndroidSetup":
639  case "CkSetup":
640  case "HBBatchSetup":
641  case "HBLiveSetup":
642  case "HBUpgrade":
643  case "iPhoneSetup":
644  case "IVRSetup":
645  case "MWebSetup":
646  case "RDCSetup":
647  case "SecureSetup":
648  case "SSLSetup":
649  case "TXTSetup":
650  case "WebSetup":
651  case "BillPaySetup":
652  case "EstmntSetup":
653  case "LoanSetup":
654  case "GoldSetup":
655  case "SilverSetup":
656  case "PlatinumSetup":
657  case "IntuitSetup":
658  return $fixedText;
659  // Monthly rates that are fixed. Divided them out of the setups in case these labels need to change.
660  case "IVR":
661  return $fixedText;
662  case "TXT":
663  case "Intuit":
664  return $fixedText;
665  case "Email":
666  return '$1 per email account.';
667  case "PEmail":
668  return '$1-$3 bump per premium email account (based on premium type).';
669  case "SSL":
670  if ($salesItemId == 123) {
671  return "$formattedVariable per member.";
672  } else if ($salesItemId == 128) {
673  return "$formattedFixed is less than or equal to $formattedQty1 members. $formattedVariable if more members than $formattedQty1.";
674  }
675 
676  $text = "Monthly fee of $formattedFixed";
677  if ($qty1 == 0) {
678  $text = $qty2 == -1 ? "$text." : "$text where number of assets is less than $formattedQty2.";
679  } else {
680  $text = $qty2 == -1 ? "$text where number of assets is more than $formattedQty1."
681  : "$text where number of assets is between $formattedQty1 and $formattedQty2.";
682  }
683  return $text;
684 
685  case "Secure":
686  if ($salesItemId == 129) {
687  return "$formattedFixed is less than or equal to $formattedQty1 members. $formattedVariable if more members than $formattedQty1.";
688  } else if ($salesItemId == 127) {
689  return "$formattedVariable per member.";
690  } else {
691  return $fixedText;
692  }
693  case "RDC":
694  return $salesItemId >= 123 ? $variableText : $fixedText;
695  case "CkImaging":
696  return $fixedText;
697  case "WEB":
698  if ($salesItemId >= 123) {
699  return "$formattedVariable per member.";
700  } else {
701  return $fixedText;
702  }
703  case "Timetrack":
704  return "HTML Support. $formattedFixed per billable hours. $formattedVariable per rush hours.";
705  case "Android":
706  case "HBBatch":
707  case "HBLive":
708  case "iPhone":
709  case "MWeb":
710  case "Loan":
711  return $variableText;
712  case "IVRUsage":
713  $textDNID = $aDNID != "" ? "for number $aDNID." : "for all numbers.";
714  $text = "$flatSunsetRate $formattedVariable";
715  if ($salesItemId == 19) {
716  return "$text per minute $textDNID";
717  } else if ($salesItemId == 21) {
718  return "$text per call $textDNID";
719  } else if ($salesItemId == 108) {
720  return "$text per minute up to $formattedQty1 minutes $textDNID";
721  } else if ($salesItemId == 109) {
722  return "$formattedVariable per minute after $formattedQty1 minutes $textDNID";
723  } else {
724  return "";
725  }
726  case "SSLCert":
727  return "$formattedFixed when completed in workflow.";
728  case "Gold":
729  case "Platinum":
730  case "Silver":
731  if ($salesItemId >= 120) {
732  return $fixedText;
733  } else {
734  return "$formattedVariable per member.";
735  }
736  case "BillPay":
737  if (in_array($salesItemId, array(134, 135, 136))) {
738  return $fixedText;
739  } else if ($salesItemId == 137) {
740  return "$formattedVariable per transaction fee";
741  } else if ($salesItemId == 138) {
742  return "$formattedVariable per stop and reissue fee";
743  } else if ($salesItemId == 139) {
744  return "$formattedVariable per letter mailed express mail";
745  } else if ($salesItemId == 140) {
746  return "$formattedVariable per NSF fee";
747  } else if ($salesItemId == 141) {
748  return "$formattedVariable per standard proof of payment";
749  } else {
750  return "";
751  }
752  default:
753  return "";
754  }
755 }
756 
757 /**
758  * function GetInitialRecurringCosts($salesItemId, $billingId, $fixed, $variable, $qty1, $qty2)
759  * @param $salesItemId -- the sales item id of the line item.
760  * @param $billingId -- the billing system id of the line item.
761  * @param $fixed -- the fixed value of the line item.
762  * @param $variable -- the variable value of the line item.
763  * @param $qty1 -- the first quantity of the line item.
764  * @param $qty2 -- the second quantity of the line item.
765  *
766  * @return array of two strings
767  * [0] is initial, [1] is recurring.
768  */
769 function GetInitialRecurringCosts($salesItemId, $billingId, $fixed, $variable, $qty1, $qty2) {
770  $formattedQty1 = number_format($qty1);
771  $formattedQty2 = number_format($qty2);
772 
773  $saveDigits = GetSaveDigits();
774  $digits = HCU_array_key_value($billingId, $saveDigits);
775  $digits = $digits === false ? 2 : intval($digits);
776 
777  $formattedFixed = $fixed < 0 ? "$(" . number_format(abs($fixed), $digits) . ")" : "$" . number_format($fixed, $digits);
778  $formattedVariable = $variable < 0 ? "$(" . number_format(abs($variable), $digits) . ")" : "$" . number_format($variable, $digits);
779 
780  switch ($billingId) {
781  case "Estmnt":
782  if ($salesItemId == 3) {
783  return array("", "(Variable)");
784  } else if ($salesItemId == 82) {
785  return array("", "$formattedVariable per mo. per E-Statement");
786  } else if ($salesItemId == 83) {
787  return array("", "Free");
788  }
789  case "AndroidSetup":
790  case "CkSetup":
791  case "HBBatchSetup":
792  case "HBLiveSetup":
793  case "HBUpgrade":
794  case "iPhoneSetup":
795  case "IVRSetup":
796  case "MWebSetup":
797  case "RDCSetup":
798  case "SecureSetup":
799  case "SSLSetup":
800  case "TXTSetup":
801  case "WebSetup":
802  case "BillPaySetup":
803  case "EstmntSetup":
804  return array($formattedFixed, "");
805  case "CkImaging":
806  case "IVR":
807  case "RDC":
808  case "Secure":
809  case "TXT":
810  case "WEB":
811  case "SSL":
812  return array("", "$formattedFixed per mo.");
813  case "Email":
814  case "PEmail":
815  case "Timetrack":
816  case "IVRUsage":
817  case "E2stmnt":
818  case "E3stmnt":
819  case "SunsetWEB":
820  return array("", "(Variable)");
821  case "Android":
822  case "HBBatch":
823  case "HBLive":
824  case "iPhone":
825  case "MWeb":
826  return array("", "$formattedVariable per member per mo.");
827  default:
828  return array("", "");
829  }
830 }
831 
832 /**
833  * function GetBillingStatuses()
834  * @return list of billing statuses.
835  */
836 function GetBillingStatuses() {
837  return array("Ready to Bill Half", "Pending", "Active", "Completed");
838 }
839 
840 /**
841  * function GetSetupBillingOptions()
842  * @return list of options for the bill half dropdownlist.
843  */
844 function GetSetupBillingOptions() {
845  return array(array("text" => "Bill Full", "value" => "full"),
846  array("text" => "Bill Full Upfront", "value" => "upfront"),
847  array("text" => "Check Received", "value" => "partial"),
848  array("text" => "Bill Half", "value" => "future"),
849  array("text" => "No Setup Record", "value" => "nosetup"));
850 }
851 
852 /**
853  * function GetBillingStatusLabel ($billingStatus, $startDate, $endDate, $setupLabel, $gridType = "")
854  * Gets the status label shown on the pending detail, active, and completed grids.
855  *
856  * @param $billingStatus -- the raw status value in the database {0,1,2,3,4,5}
857  * @param $startDate -- the start date of the line item.
858  * @param $endDate -- the end date of the line item.
859  * @param $setupLabel -- "setup", "recurring", or "triggered" @see GetSetupRecurring()
860  * @param $gridType -- "pending", "active", or "completed." This is context to get the "undo" status.
861  *
862  * @return $status -- "000" if successful, nonzero otherwise.
863  * @return $error -- "" if successful, nonempty otherwise.
864  * @return $data.statusLabel -- The label to show.
865  * @return $data.billingStatusGroup -- the number to put line item in the correct grid.
866  */
867 function GetBillingStatusLabel ($billingStatus, $startDate, $endDate, $setupLabel, $gridType = "") {
868  try {
869  $statusLabel = "";
870  $billingStatusGroup = -1;
871  if ($setupLabel == "triggered" && $billingStatus == 1) {
872  $billingStatusGroup = 1;
873  $statusLabel = "Not triggered";
874  } else {
875  $billingStatusLabels = GetBillingStatuses();
876  $statusLabel = HCU_array_key_value($billingStatus, $billingStatusLabels);
877 
878  if ($billingStatus == 2 || $billingStatus == 3) {
879  $startDateTime = new DateTime($startDate);
880  $formattedStartDate = $startDateTime->format("m/Y");
881  $now = new DateTime();
882  $nextMonth = new DateTime();
883  $m = $now->format("m");
884  $Y = $now->format("Y");
885  $now->setDate($Y, $m, 1);
886  $nextMonth->setDate($Y, $m + 1, 1);
887  $beforeStartDate = $now < $startDateTime;
888  $startingThisMonth = $now->format("m/Y") == $startDateTime->format("m/Y");
889 
890  if ($endDate != "") {
891  $endDateTime = new DateTime($endDate);
892  $afterEndDate = $now > $endDateTime;
893  $endingThisMonth = $now->format("m/Y") == $endDateTime->format("m/Y");
894  $endingNextMonth = $nextMonth->format("m/Y") == $endDateTime->format("m/Y");
895  } else {
896  $afterEndDate = false;
897  $endingThisMonth = false;
898  $endingNextMonth = false;
899  }
900 
901  if ($gridType == "completed" && !$afterEndDate) {
902  $statusLabel = "Reactivated";
903  } else if ($setupLabel == "triggered") {
904  $billingStatusGroup = 0;
905  $statusLabel = "Triggered $formattedStartDate";
906  } else if ($beforeStartDate || $startingThisMonth || $gridType == "pending") {
907  if ($setupLabel == "recurring") {
908  $statusLabel = "Starting $formattedStartDate";
909  } else {
910  $statusLabel = "On $formattedStartDate";
911  }
912 
913  $billingStatusGroup = 1;
914  } else if ($endingThisMonth) {
915  $statusLabel = "Ending this month";
916  $billingStatusGroup = 0;
917  } else if ($endingNextMonth) {
918  $statusLabel = "Ending next month";
919  $billingStatusGroup = 0;
920  } else if ($afterEndDate) {
921  $statusLabel = "Completed";
922  $billingStatusGroup = 2;
923  } else {
924  $statusLabel = "Active";
925  $billingStatusGroup = 0;
926  }
927  } else {
928  $billingStatusGroup = 1;
929  if ($billingStatus == 0) {
930  $statusLabel = "Pending Workflow, Billing Half";
931  } else if ($billingStatus == 1) {
932  switch($setupLabel) {
933  case "setup":
934  $statusLabel = "Pending Workflow";
935  break;
936  case "recurring":
937  $statusLabel = "Pending";
938  break;
939  }
940  } else if ($billingStatus == 4 || $billingStatus == 5) {
941  $statusLabel = "No Workflow";
942  } else {
943  $statusLabel = "Unknown Status";
944  }
945  }
946  }
947 
948  $returnArray = array("status" => "000", "error" => "", "data" => array("statusLabel" => $statusLabel, "billingStatusGroup" => $billingStatusGroup));
949  } catch (exception $e) {
950  $returnArray = array("status" => $e->getCode(), "error" => $e->getMessage());
951  }
952  return $returnArray;
953 }
954 
955 /**
956  * function GetHalfBillingStatus($setup, $billHalf, $partiallyBilledDate, $startDate)
957  * Gets the label for if the line item is to be billed half.
958  *
959  * @param $setup -- true if line item is a setup. False otherwise.
960  * @param $billHalf -- the value of the billHalf column in the database.
961  * @param $partiallyBilledDate -- the value of the partiallyBilledDate column in the database.
962  * @param $startDate -- the value of the startDate column in the database.
963  *
964  * @return $status -- "000" if successful, nonzero otherwise.
965  * @return $error -- "" if successful, nonempty otherwise.
966  * @return $data.statusLabel -- the label to display.
967  */
968 function GetHalfBillingStatus($setup, $billHalf, $partiallyBilledDate, $startDate) {
969  try {
970  $statusLabel = "";
971  if (!$setup) {
972  $statusLabel = "N/A";
973  } else if ($billHalf == "Y") {
974  if ($partiallyBilledDate == null || $partiallyBilledDate == "") {
975  throw new exception ("Partially Billed Date is required.", 1);
976  }
977  $dateTime = new DateTime($partiallyBilledDate);
978  $dateFormat = $dateTime->format("m/Y");
979  $statusLabel = $dateFormat;
980  } else if ($partiallyBilledDate != null && $partiallyBilledDate != "") {
981  $dateTime = new DateTime($startDate);
982  $dateFormat = $dateTime->format("m/Y");
983  $statusLabel = "Credited";
984  } else {
985  $statusLabel = "N/A";
986  }
987 
988  $returnArray = array("status" => "000", "error" => "", "data" => array("statusLabel" => $statusLabel));
989  } catch (exception $e) {
990  $returnArray = array("status" => $e->getCode(), "error" => $e->getMessage());
991  }
992  return $returnArray;
993 }
994 
995 /**
996  * function GetFrequencyLabel($billsOnInt, $setup)
997  * Gets the frequency label of the line item.
998  *
999  * @param $billsOnInt -- the value of the bills on column in the database.
1000  * @param $setup -- "triggered", "setup", or "recurring."
1001  *
1002  * @return $data.frequencyLabel -- the label to display.
1003  * @return $data.billsOnKendo -- the values to show in the dropdownlists.
1004  */
1005 function GetFrequencyLabel($billsOnInt, $setup) {
1006  $frequencyLabel = "";
1007  $billsOnKendo = "";
1008  if ($setup == "triggered") {
1009  $frequencyLabel = "Triggered";
1010  } else if ($setup != "setup") {
1011  $billsOnInt &= 4095; // 4095 is the value with the first 12 bits set. If higher bits are set, they are ignored.
1012  if ($billsOnInt == 4095) {
1013  $frequencyLabel = "Monthly";
1014  } else {
1015  $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
1016  $digit = 1;
1017  $usedMonths = array();
1018  $usedIs = array();
1019  for($i = 0, $count = count($months); $i != $count; $i++) {
1020  if (($billsOnInt & $digit) != 0) {
1021  $usedMonths[] = $months[$i];
1022  $usedIs[] = $i;
1023  $billsOnInt &= ~$digit;
1024  }
1025  if ($billsOnInt == 0) {
1026  break;
1027  }
1028  $digit <<= 1;
1029  }
1030  $count = count($usedMonths);
1031  if ($count == 0 || $count == 12) {
1032  $frequencyLabel = "Monthly";
1033  } else if ($count <= 2) {
1034  $frequencyLabel = "Bills on " . implode($usedMonths, " and ") . ".";
1035  $billsOnKendo = implode($usedIs, ",");
1036  } else {
1037  $usedMonths [$count - 1] = "and " . $usedMonths [$count - 1];
1038  $frequencyLabel = "Bills on " . implode($usedMonths, ", ") . ".";
1039  $billsOnKendo = implode($usedIs, ",");
1040  }
1041  }
1042  }
1043 
1044  return array("data" => array("frequencyLabel" => $frequencyLabel, "billsOnKendo" => $billsOnKendo));
1045 }
1046 
1047 /**
1048  * function getFrequencyBillsOn($billsOn, &$frequency, &$billsOnInt)
1049  * Get the frequency bills on text (from a bit column)
1050  *
1051  * @param $billsOn -- the value of the bills on column in the database.
1052  *
1053  * @return $status -- "000" if successful, nonzero otherwise.
1054  * @return $error -- "" if successful, nonempty otherwise.
1055  * @return integer $data.frequency -- returns the frequency here: (0 -- monthly apparently, 1 -- semiyearly apparently, 2 -- yearly apparently)
1056  * @return integer $data.billsOnInt -- returns the corresponding bills on number for saving into the database.
1057  */
1058 function GetFrequencyBillsOn($billsOn) {
1059  try {
1060  $frequency = 0;
1061  $billsOnInt = -1;
1062 
1063  if ($billsOn != "") {
1064  $billsOnDecoded = HCU_JsonDecode($billsOn);
1065  $number = count($billsOnDecoded);
1066  switch($number) {
1067  case 0:
1068  $frequency = 0;
1069  $billsOnInt = -1;
1070  break;
1071  case 1: // Yearly
1072  $frequency = 2;
1073  $billsOnInt = 0;
1074  break;
1075  case 2: // semiyearly
1076  $frequency = 1;
1077  $billsOnInt = 0;
1078  break;
1079  }
1080  foreach($billsOnDecoded as $num) {
1081  if (!is_numeric($num)) {
1082  throw new exception("Bills on array needs to be all integers.", 1);
1083  }
1084  if (intval($num) < 0 || intval($num) > 11) {
1085  throw new exception("Bills on array needs to correspond to the months.", 2);
1086  }
1087 
1088  $digit = 1 << $num;
1089  $billsOnInt |= $digit;
1090  }
1091  } else {
1092  $frequency = 0;
1093  $billsOnInt = -1;
1094  }
1095 
1096  $returnArray = array("status" => "000", "error" => "", "data" => array("frequency" => $frequency, "billsOnInt" => $billsOnInt));
1097  } catch (exception $e) {
1098  $returnArray = array("status" => $e->getCode(), "error" => $e->getMessage());
1099  }
1100  return $returnArray;
1101 }
1102 
1103 
1104 
1105