?> </th> <th><?php echo ORD_DELIVERY_DATES; ?> </th> <th><?php echo ORD_NEW_DELIVERY_DATES; ?> </th> </tr> <?php $j = 1; while (!$ordr_items->EOF) { $price = $currencies->format($level_info[0] ? $level_info[0] : ($i == 0 ? $full_price : 0)); echo '<tr>' . chr(10); echo ' <td align="center">' . $ordr_items->fields['qty'] . '</td>' . chr(10); echo ' <td align="center">' . $ordr_items->fields['sku'] . '</td>' . chr(10); echo ' <td>' . $ordr_items->fields['description'] . '</td>' . chr(10); echo ' <td align="center">' . gen_date_short($ordr_items->fields['date_1']) . '</td>' . chr(10); echo ' <td align="center">'; echo html_hidden_field('id_' . $j, $ordr_items->fields['id']) . chr(10); echo ' <script type="text/javascript">date_' . $j . '.writeControl(); date_' . $j . '.displayLeft=true; date_' . $j . '.dateFormat="' . DATE_FORMAT_SPIFFYCAL . '";</script>' . chr(10); echo ' </td>' . chr(10); echo '</tr>'; $j++; $ordr_items->MoveNext(); } ?> </table> </form>
function TextReplace($text_string) { global $Prefs, $report_title; // substitutes a command string with dynamic information $text_string = str_replace('%date%', gen_date_short(date('Y-m-d')), $text_string); $text_string = str_replace('%reportname%', $report_title, $text_string); $text_string = str_replace('%company%', COMPANY_NAME, $text_string); return $text_string; }
</th> <th><?php echo TEXT_END_DATE; ?> </th> </tr> <?php $i = 0; foreach ($fy_array as $key => $value) { echo '<tr><td width="33%" align="center">' . $key . html_hidden_field('per_' . $i, $key) . '</td>' . chr(10); echo '<td width="33%" align="center" nowrap="nowrap">' . html_input_field('start_' . $i, gen_date_short($value['start']), 'readonly="readonly"', false, 'text', false) . '</td>' . chr(10); if ($key > $max_period) { // only allow changes if nothing has bee posted above this period echo '<td width="33%" nowrap="nowrap"><script type="text/javascript">P' . $i . 'End.writeControl(); P' . $i . 'End.dateFormat="' . DATE_FORMAT_SPIFFYCAL . '"; P' . $i . 'End.JStoRunOnSelect="updateEnd(' . $i . ')";</script></td>' . chr(10); } else { echo '<td width="33%" align="center" nowrap="nowrap">' . html_input_field('end_' . $i, gen_date_short($value['end']), 'readonly="readonly"', false, 'text', false) . '</td>' . chr(10); } echo '</tr>' . chr(10); $i++; } ?> </table></td> </tr> </table></td> <td valign="top" align="right"> <?php echo html_hidden_field('period', '') . chr(10); echo '<p>' . html_submit_field('change', GL_BTN_CHG_ACCT_PERIOD, 'onclick="if (!fetchPeriod()) return false"') . '</p>' . chr(10); echo '<p>' . html_submit_field('update', GL_BTN_UPDATE_FY) . '</p>' . chr(10); echo '<p>' . html_submit_field('new', GL_BTN_NEW_FY, 'onclick="if (!confirm(\'' . GL_WARN_ADD_FISCAL_YEAR . ($highest_fy + 1) . '\')) return false"') . '</p>' . chr(10);
$contents[] = array('align' => 'center', 'text' => '<br />' . html_button_field('cancel', TEXT_CANCEL, 'onclick="location.href=\'' . html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('gID', 'cID', 'action')) . 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id, 'SSL') . '\'"')); } break; default: if (isset($cInfo) && is_object($cInfo)) { $heading[] = array('text' => '<b>' . (defined($cInfo->configuration_title) ? constant($cInfo->configuration_title) : $cInfo->configuration_title) . '</b>'); if (ADMIN_CONFIGURATION_KEY_ON == 1) { $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />'); } if ($_SESSION['admin_security'][SECURITY_ID_CONFIGURATION] > 2) { $contents[] = array('align' => 'center', 'text' => html_button_field('edit', TEXT_EDIT, 'onclick="location.href=\'' . html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('gID', 'cID', 'action')) . 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit', 'SSL') . '\'"')); } $contents[] = array('text' => '<br />' . (defined($cInfo->configuration_description) ? constant($cInfo->configuration_description) : $cInfo->configuration_description)); $contents[] = array('text' => '<br />' . SETUP_INFO_DATE_ADDED . ' ' . gen_date_short($cInfo->date_added)); if (gen_not_null($cInfo->last_modified)) { $contents[] = array('text' => SETUP_INFO_LAST_MODIFIED . ' ' . gen_date_short($cInfo->last_modified)); } } break; } if (gen_not_null($heading) && gen_not_null($contents)) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box(); echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table></td> </tr>
</tr> <?php while (!$query_result->EOF) { if ($query_result->fields['store_id'] == '0') { $store_name = COMPANY_ID; } else { $result = $db->Execute("select short_name from " . TABLE_CONTACTS . " where id = '" . $query_result->fields['store_id'] . "'"); $store_name = $result->fields['short_name']; } ?> <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick='setReturnEntry(<?php echo $query_result->fields['id']; ?> )'> <td class="dataTableContent"><?php echo gen_date_short($query_result->fields['post_date']); ?> </td> <td class="dataTableContent"><?php echo $query_result->fields['purchase_invoice_id']; ?> </td> <td class="dataTableContent"><?php echo $query_result->fields['qty']; ?> </td> <td class="dataTableContent"><?php echo $query_result->fields['sku']; ?> </td> <td class="dataTableContent"><?php
function gen_build_sql_date($date_prefs, $df) { global $db; $dates = gen_get_dates(); $DateArray = explode(':', $date_prefs); $t = time(); $ds = '0000-00-00'; // pick a start date a long time ago $de = '2199-00-00'; // pick an end date a long time from now switch ($DateArray[0]) { // based on the date choice selected default: case "a": // All, skip the date addition to the where statement, all dates in db $d = ''; $fildesc = ''; break; case "b": // Date Range $d = ''; $fildesc = RW_RPT_DATERANGE; if ($DateArray[1] != '') { $ds = gen_db_date_short($DateArray[1]); $d .= $df . " >= '" . $ds . "'"; $fildesc .= ' ' . TEXT_FROM . ' ' . $DateArray[1]; } if ($DateArray[2] != '') { // a value entered, check if (strlen($d) > 0) { $d .= ' and '; } $de = gen_specific_date(gen_db_date_short($DateArray[2]), 1); $d .= $df . " < '" . $de . "'"; $fildesc .= ' ' . TEXT_TO . ' ' . $DateArray[2]; } $fildesc .= '; '; break; case "c": // Today (specify range for datetime type fields to match for time parts) $ds = $dates['Today']; $de = gen_specific_date($dates['Today'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' = ' . gen_date_short($dates['Today']) . '; '; break; case "d": // This Week $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t), $dates['ThisYear'])); $de = gen_specific_date(date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t) + 6, $dates['ThisYear'])), 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short(gen_specific_date($de, -1)) . '; '; break; case "e": // This Week to Date $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t), $dates['ThisYear'])); $de = gen_specific_date($dates['Today'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($dates['Today']) . '; '; break; case "f": // This Month $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], 1, $dates['ThisYear'])); $de = gen_specific_date(date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], $dates['TotalDays'], $dates['ThisYear'])), 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short(gen_specific_date($de, -1)) . '; '; break; case "g": // This Month to Date $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], 1, $dates['ThisYear'])); $de = gen_specific_date($dates['Today'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($dates['Today']) . '; '; break; case "h": // This Quarter $QtrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 3; $temp = gen_calculate_fiscal_dates($QtrStrt); $ds = $temp['start_date']; $temp = gen_calculate_fiscal_dates($QtrStrt + 2); $de = gen_specific_date($temp['end_date'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($temp['end_date']) . '; '; break; case "i": // Quarter to Date $QtrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 3; $temp = gen_calculate_fiscal_dates($QtrStrt); $ds = $temp['start_date']; $de = gen_specific_date($dates['Today'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($dates['Today']) . '; '; break; case "j": // This Year $YrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 12; $temp = gen_calculate_fiscal_dates($YrStrt); $ds = $temp['start_date']; $temp = gen_calculate_fiscal_dates($YrStrt + 11); $de = gen_specific_date($temp['end_date'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($temp['end_date']) . '; '; break; case "k": // Year to Date $YrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 12; $temp = gen_calculate_fiscal_dates($YrStrt); $ds = $temp['start_date']; $de = gen_specific_date($dates['Today'], 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($dates['Today']) . '; '; break; case "l": // This Period $ds = CURRENT_ACCOUNTING_PERIOD_START; $de = gen_specific_date(CURRENT_ACCOUNTING_PERIOD_END, 1); $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'"; $fildesc = TEXT_PERIOD . ' ' . CURRENT_ACCOUNTING_PERIOD . ' (' . gen_date_short(CURRENT_ACCOUNTING_PERIOD_START) . ' ' . TEXT_TO . ' ' . gen_date_short(CURRENT_ACCOUNTING_PERIOD_END) . '); '; break; case "z": // date by period $temp = gen_calculate_fiscal_dates($DateArray[1]); $ds = $temp['start_date']; $de = $temp['end_date']; $d = 'period = ' . $DateArray[1]; $fildesc = TEXT_PERIOD . ' ' . $DateArray[1] . ' (' . gen_date_short($ds) . ' ' . TEXT_TO . ' ' . gen_date_short($de) . '); '; break; } $dates = array('sql' => $d, 'description' => $fildesc, 'start_date' => $ds, 'end_date' => $de); return $dates; }