3 include_once($path_to_root . "/admin/db/voiding_db.inc");
5 //--------------------------------------------------------------------------------------
7 function get_supplier_trans_view_str($type, $trans_no, $label="")
9 global $path_to_root, $use_popup_windows;
12 if ($type == systypes::po())
13 $viewer = "view_po.php";
15 $viewer = "view_supp_invoice.php";
17 $viewer = "view_supp_credit.php";
19 $viewer = "view_supp_payment.php";
21 $viewer = "view_grn.php";
30 if ($use_popup_windows)
31 $preview_str = "<a target='_blank' href='$path_to_root/purchasing/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
33 $preview_str = "<a target='_blank' href='$path_to_root/purchasing/view/$viewer?trans_no=$trans_no'>$label</a>";
36 $preview_str = $label;
41 //--------------------------------------------------------------------------------------
43 function get_gl_view_str($type, $trans_no, $label="", $force=false)
45 global $path_to_root, $use_popup_windows;
47 if (!$force && !user_show_gl_info())
52 if ($use_popup_windows)
53 $gl_view = "<a target='_blank' href='$path_to_root/gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
55 $gl_view = "<a target='_blank' href='$path_to_root/gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no'>$label</a>";
60 //--------------------------------------------------------------------------------------
62 function get_gl_view_str_cell($type, $trans_no, $label="")
64 $str = get_gl_view_str($type, $trans_no, $label);
66 return "<td>$str</td>";
69 //--------------------------------------------------------------------------------------
71 function get_customer_trans_view_str($type, $trans_no, $label="")
73 global $path_to_root, $use_popup_windows;
77 $viewer = "view_invoice.php";
79 $viewer = "view_credit.php";
81 $viewer = "view_receipt.php";
83 $viewer = "view_sales_order.php";
92 if ($use_popup_windows)
93 $preview_str = "<a target='_blank' href='$path_to_root/sales/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
95 $preview_str = "<a target='_blank' href='$path_to_root/sales/view/$viewer?trans_no=$trans_no'>$label</a>";
98 $preview_str = $label;
103 //--------------------------------------------------------------------------------------
105 function get_banking_trans_view_str($type, $trans_no, $label="")
107 global $path_to_root, $use_popup_windows;
112 $viewer = "bank_transfer_view.php";
114 $viewer = "gl_payment_view.php";
116 $viewer = "gl_deposit_view.php";
127 if ($use_popup_windows)
128 $preview_str = "<a target='_blank' href='$path_to_root/gl/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
130 $preview_str = "<a target='_blank' href='$path_to_root/gl/view/$viewer?trans_no=$trans_no'>$label</a>";
133 $preview_str = $label;
138 //--------------------------------------------------------------------------------------
140 function get_inventory_trans_view_str($type, $trans_no, $label="")
142 global $path_to_root, $use_popup_windows;
146 if ($type == systypes::inventory_adjustment())
147 $viewer = "view_adjustment.php";
148 elseif ($type == systypes::location_transfer())
149 $viewer = "view_transfer.php";
158 if ($use_popup_windows)
159 $preview_str = "<a target='_blank' href='$path_to_root/inventory/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
161 $preview_str = "<a target='_blank' href='$path_to_root/inventory/view/$viewer?trans_no=$trans_no'>$label</a>";
164 $preview_str = $label;
169 //--------------------------------------------------------------------------------------
171 function get_manufacturing_trans_view_str($type, $trans_no, $label="")
173 global $path_to_root, $use_popup_windows;
178 $viewer = "wo_issue_view.php";
180 $viewer = "wo_production_view.php";
181 elseif ($type == systypes::work_order())
182 $viewer = "work_order_view.php";
191 if ($use_popup_windows)
192 $preview_str = "<a target='_blank' href='$path_to_root/manufacturing/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
194 $preview_str = "<a target='_blank' href='$path_to_root/manufacturing/view/$viewer?trans_no=$trans_no'>$label</a>";
197 $preview_str = $label;
202 //--------------------------------------------------------------------------------------
204 function get_dimensions_trans_view_str($type, $trans_no, $label="")
206 global $path_to_root, $use_popup_windows;
211 $viewer = "view_dimension.php";
220 if ($use_popup_windows)
221 $preview_str = "<a target='_blank' href='$path_to_root/dimensions/view/$viewer?trans_no=$trans_no' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$label</a>";
223 $preview_str = "<a target='_blank' href='$path_to_root/dimensions/view/$viewer?trans_no=$trans_no'>$label</a>";
226 $preview_str = $label;
231 //--------------------------------------------------------------------------------------
233 function get_trans_view_str($type, $trans_no, $label="")
235 $view_str = get_customer_trans_view_str($type, $trans_no, $label);
236 if ($view_str != null)
239 $view_str = get_supplier_trans_view_str($type, $trans_no, $label);
240 if ($view_str != null)
243 $view_str = get_banking_trans_view_str($type, $trans_no, $label);
244 if ($view_str != null)
247 $view_str = get_inventory_trans_view_str($type, $trans_no, $label);
248 if ($view_str != null)
251 $view_str = get_manufacturing_trans_view_str($type, $trans_no, $label);
252 if ($view_str != null)
255 $view_str = get_dimensions_trans_view_str($type, $trans_no, $label);
256 if ($view_str != null)
262 //--------------------------------------------------------------------------------------
264 function exchange_rate_display($from_currency, $to_currency, $date_, $buttons=true)
266 if ($from_currency != $to_currency)
268 if ($buttons && isset($_POST['get_rate']))
270 $comp_currency = get_company_currency();
271 if ($from_currency == $comp_currency)
272 $currency = $to_currency;
274 $currency = $from_currency;
275 $rate = get_ecb_rate($currency);
276 if (get_date_exchange_rate($currency, $date_))
277 update_exchange_rate($currency, $date_, $rate, $rate);
279 add_exchange_rate($currency, $date_, $rate, $rate);
280 if ($from_currency == $comp_currency)
284 $rate = get_exchange_rate_from_to($to_currency, $from_currency, $date_);
285 $rate = number_format2($rate, user_exrate_dec());
286 label_row(_("Exchange Rate:"),"1 " . $from_currency . " = " . $rate . " " . $to_currency .
287 ($buttons?" " . submit('get_rate',_("Get"), false):""));
291 //--------------------------------------------------------------------------------------
293 function is_voided_display($type, $id, $label)
296 $void_entry = get_voided_entry($type, $id);
298 if ($void_entry == null)
301 start_table("width=50% $table_style");
302 echo "<tr><td align=center><font color=red>$label</font><br>";
303 echo "<font color=red>" . _("Date Voided:") . " " . sql2date($void_entry["date_"]) . "</font><br>";
304 if (strlen($void_entry["memo_"]) > 0)
305 echo "<center><font color=red>" . _("Memo:") . " " . $void_entry["memo_"] . "</font><br>";
312 //--------------------------------------------------------------------------------------
314 function comments_display_row($type, $id)
316 $comments = get_comments($type, $id);
317 if ($comments and db_num_rows($comments))
319 echo "<tr><td colspan=15>";
320 while ($comment = db_fetch($comments))
322 echo $comment["memo_"] . "<br>";
328 //--------------------------------------------------------------------------------------
330 function get_comments_string($type, $type_no)
333 $result = get_comments($type, $type_no);
334 while ($comment = db_fetch($result))
336 if (strlen($str_return))
337 $str_return = $str_return . " \n";
338 $str_return = $str_return . $comment["memo_"];
343 //--------------------------------------------------------------------------------------
345 function view_stock_status($stock_id, $description=null)
347 global $path_to_root;
349 //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", (user_show_codes()?$stock_id . " - ":"") . $description, "stock_id=$stock_id");
350 $preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >". (user_show_codes()?$stock_id . " - ":"") . $description."</a>";
352 //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", $stock_id, "stock_id=$stock_id");
353 $preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$stock_id</a>";
357 function view_stock_status_cell($stock_id, $description=null)
360 view_stock_status($stock_id, $description);
364 //--------------------------------------------------------------------------------------
366 function display_debit_or_credit_cells($value)
376 amount_cell(abs($value));
386 //--------------------------------------------------------------------------------------
388 function display_customer_trans_tax_details($tax_items, $columns)
390 while ($tax_item = db_fetch($tax_items))
392 $tax = number_format2($tax_item['amount'],user_price_dec());
393 if ($tax_item['included_in_price'])
394 label_row(_("Included") . " " . $tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%) " .
395 _("Amount") . ": $tax", "", "colspan=$columns align=right", "align=right");
397 label_row($tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%)",
398 $tax, "colspan=$columns align=right", "align=right");
402 //--------------------------------------------------------------------------------------
404 function display_supp_trans_tax_details($tax_items, $columns)
406 while ($tax_item = db_fetch($tax_items))
408 $tax = number_format2(abs($tax_item['amount']),user_price_dec());
409 if ($tax_item['included_in_price'])
410 label_row(_("Included") . " " . $tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%) " .
411 _("Amount:") . ": $tax", "colspan=$columns align=right", "align=right");
413 label_row($tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%)",
414 $tax, "colspan=$columns align=right", "align=right");
418 //--------------------------------------------------------------------------------------
420 function display_edit_tax_items($taxes, $columns)
424 foreach ($taxes as $taxitem)
426 if ($taxitem['included_in_price'])
428 label_row(_("Included") . " " . $taxitem['tax_type_name'] . " (" . $taxitem['rate'] . "%) " .
429 _("Amount:") . " " . number_format2($taxitem['Value'],user_price_dec()), "", "colspan=$columns align=right", "align=right");
433 label_row($taxitem['tax_type_name'] . " (" . $taxitem['rate'] . "%)",
434 number_format2($taxitem['Value'],user_price_dec()), "colspan=$columns align=right", "align=right");
435 $total += $taxitem['Value'];
442 //--------------------------------------------------------------------------------------
444 function display_footer_exit()
446 global $path_to_root;
452 //--------------------------------------------------------------------------------------
454 function display_allocations($alloc_result, $total)
458 if (!$alloc_result || db_num_rows($alloc_result) == 0)
461 display_heading2(_("Allocations"));
463 start_table("$table_style width=80%");
465 $th = array( _("Type"), _("Number"), _("Date"), _("Total Amount"),
466 _("Left to Allocate"), _("This Allocation"));
468 $k = $total_allocated = 0;
470 while ($alloc_row = db_fetch($alloc_result))
473 alt_table_row_color($k);
475 label_cell(systypes::name($alloc_row['type']));
476 label_cell(get_trans_view_str($alloc_row['type'],$alloc_row['trans_no']));
477 label_cell(sql2date($alloc_row['tran_date']));
478 amount_cell($alloc_row['Total']);
479 //amount_cell($alloc_row['Total'] - $alloc_row['PrevAllocs'] - $alloc_row['amt']);
480 amount_cell($alloc_row['Total'] - $alloc_row['amt']);
481 amount_cell($alloc_row['amt']);
484 $total_allocated += $alloc_row['amt'];
487 label_cell(_("Total Allocated:"), "align=right colspan=5");
488 amount_cell($total_allocated);
491 label_cell(_("Left to Allocate:"), "align=right colspan=5");
492 amount_cell($total - $total_allocated);
498 //--------------------------------------------------------------------------------------
500 function display_allocations_from($person_type, $person_id, $type, $type_no, $total)
502 switch ($person_type)
504 case payment_person_types::customer() :
505 $alloc_result = get_allocatable_to_cust_transactions($person_id, $type_no, $type);
506 display_allocations($alloc_result, $total);
508 case payment_person_types::supplier() :
509 $alloc_result = get_allocatable_to_supp_transactions($person_id, $type_no, $type);
510 display_allocations($alloc_result, $total);
515 function get_js_go_back()
517 $js = "\n<script type=\"text/javascript\">\n"
519 . "function goBack()\n"
521 . " if (window.history.length <= 1)\n"
522 . " window.close();\n"
524 . " window.history.go(-1);\n"
531 function get_js_open_window($width, $height)
533 $js = "\n<script type=\"text/javascript\">\n"
535 . "function openWindow(url, title)\n"
537 . " var left = (screen.width - $width) / 2;\n"
538 . " var top = (screen.height - $height) / 2;\n"
539 . " window.open(url, title, 'width=$width,height=$height,left='+left+',top='+top+',screenX='+left+',screenY='+top+',status=no,scrollbars=yes');\n"
546 function get_js_form_entry($edit_name, $sel_name, $next_name)
548 $js = "\n<script type=\"text/javascript\">\n"
550 . "function recalcAccounts()\n"
552 . " var myForm = document.forms[0];\n"
553 . " var len = myForm.$sel_name.length;\n"
555 . " var ac = myForm.$edit_name.value;\n"
557 . " myForm.$sel_name.options[myForm.$sel_name.selectedIndex].selected = false;\n"
558 . " for (i = 0; i < len; i++)\n"
560 . " txt = myForm.$sel_name.options[i].text;\n"
561 . " if (txt.indexOf(ac) == 0)\n"
563 . " myForm.$sel_name.options[i].selected = true;\n"
568 . "function setAccount(p, s)\n"
570 . " var myForm = document.forms[0];\n"
571 . " if (p == 0 && myForm.$edit_name.value == \"\")\n"
573 . " myForm.$edit_name.value = myForm.$sel_name.options[myForm.$sel_name.selectedIndex].value;\n"
575 . " myForm.submit();\n"
576 . " myForm.$next_name.focus();\n"
584 function get_js_set_focus($name)
586 $js = "\n<script type=\"text/javascript\">\n"
588 . "function setFocus()\n"
590 . " document.forms[0].$name.focus();\n"
597 function get_js_png_fix()
599 $js = "<script type=\"text/javascript\">\n"
600 . "function fixPNG(myImage)\n"
602 . " var arVersion = navigator.appVersion.split(\"MSIE\")\n"
603 . " var version = parseFloat(arVersion[1])\n"
604 . " if ((version >= 5.5) && (version < 7) && (document.body.filters))\n"
606 . " var imgID = (myImage.id) ? \"id='\" + myImage.id + \"' \" : \"\"\n"
607 . " var imgClass = (myImage.className) ? \"class='\" + myImage.className + \"' \" : \"\"\n"
608 . " var imgTitle = (myImage.title) ?\n"
609 . " \"title='\" + myImage.title + \"' \" : \"title='\" + myImage.alt + \"' \"\n"
610 . " var imgStyle = \"display:inline-block;\" + myImage.style.cssText\n"
611 . " var strNewHTML = \"<span \" + imgID + imgClass + imgTitle\n"
612 . " + \" style=\\\"\" + \"width:\" + myImage.width\n"
613 . " + \"px; height:\" + myImage.height\n"
614 . " + \"px;\" + imgStyle + \";\"\n"
615 . " + \"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader\"\n"
616 . " + \"(src=\'\" + myImage.src + \"\', sizingMethod='scale');\\\"></span>\"\n"
617 . " myImage.outerHTML = strNewHTML\n"
624 function get_js_date_picker()
627 //global $dateseps $path_to_root;
629 //$encoding = "iso-8859-1"; // character encoding
630 //$encoding = $_SESSION['language']->encoding; // character encoding
631 //$dir = "ltr"; // left to right, right to left
632 //$dir = $_SESSION['language']->dir; // left to right, right to left
633 $how = user_date_format(); // 0 = us/ca, 1 = eu, au, nz, 2 = jp, sw
634 $sep = $dateseps[user_date_sep()]; // date separator
635 $wstart = ($how == 0 ? 0 : 1); // weekstart (sun = 0, mon = 1)
638 #CCIFrame { display: none; left: 0px; position: absolute; top: 0px; height: 250px; width: 250px; z-index: 99;}
639 #CC { position:absolute; background-color:#FFF; margin:0; padding:0; display:none; z-index: 100;}
640 #CC table { font-family: arial, verdana, helvetica, sans-serif;font-size: 8pt; border-left: 1px solid #336; border-right: 1px solid #336;}
641 #CC th { font-weight: normal;}
642 #CC th a { font-weight: normal; text-decoration: none; color: #FFF; padding: 1px;}
643 #CC td { text-align: center;}
644 #CC .header { background-color: #336;}
645 #CC .weekday { background-color: #DDD; color: #000;}
646 #CC .weekend { background-color: #FFC; color: #000;}
647 #CC .current { border: 1px solid #339; background-color: #336; color: #FFF;}
648 #CC .weekday,#CC .weekend,#CC .current { display: block; text-decoration: none; border: 1px solid #FFF; width: 2em;}
649 #CC .weekday:hover,#CC .weekend:hover,#CC .current:hover { color: #FFF; background-color: #336; border: 1px solid #999;}
650 #CC .previous { text-align: left;}
651 #CC .next { text-align: right;}
652 #CC .previous,#CC .next { padding: 1px 3px 1px 3px; font-size: 1.4em;}
653 #CC .previous a,#CC .next a { color: #FFF; text-decoration: none; font-weight: bold;}
654 #CC .title { text-align: center; font-weight: bold; color: #FFF;}
655 #CC .empty { background-color: #CCC; border: 1px solid #FFF;}
658 $js .= "<script type=\"text/javascript\">
660 function positionInfo(object) {
662 this.getElementLeft = getElementLeft;
663 function getElementLeft() {
666 if(typeof(p_elm) == 'object'){
669 elm = document.getElementById(p_elm);
671 while (elm != null) {
673 elm = elm.offsetParent;
677 this.getElementWidth = getElementWidth;
678 function getElementWidth(){
680 if(typeof(p_elm) == 'object'){
683 elm = document.getElementById(p_elm);
685 return parseInt(elm.offsetWidth);
687 this.getElementRight = getElementRight;
688 function getElementRight(){
689 return getElementLeft(p_elm) + getElementWidth(p_elm);
691 this.getElementTop = getElementTop;
692 function getElementTop() {
695 if(typeof(p_elm) == 'object'){
698 elm = document.getElementById(p_elm);
700 while (elm != null) {
702 elm = elm.offsetParent;
706 this.getElementHeight = getElementHeight;
707 function getElementHeight(){
709 if(typeof(p_elm) == 'object'){
712 elm = document.getElementById(p_elm);
714 return parseInt(elm.offsetHeight);
716 this.getElementBottom = getElementBottom;
717 function getElementBottom(){
718 return getElementTop(p_elm) + getElementHeight(p_elm);
722 var calendarId = 'CC';
724 var currentMonth = 0;
726 var selectedYear = 0;
727 var selectedMonth = 0;
729 var months = ['"._("January")."','"._("February")."','"._("March")."','"._("April")."','"._("May")."','"._("June")."','"._("July")."','"._("August")."','"._("September")."','"._("October")."','"._("November")."','"._("December")."'];
730 var wdays = ['"._("Su")."', '"._("Mo")."', '"._("Tu")."', '"._("We")."', '"._("Th")."', '"._("Fr")."', '"._("Sa")."'];
731 var dateField = null;
732 function getProperty(p_property){
733 var p_elm = calendarId;
735 if(typeof(p_elm) == 'object'){
738 elm = document.getElementById(p_elm);
744 return elm[p_property];
753 function setElementProperty(p_property, p_value, p_elmId){
756 if(typeof(p_elm) == 'object'){
759 elm = document.getElementById(p_elm);
761 if((elm != null) && (elm.style != null)){
763 elm[ p_property ] = p_value;
766 function setProperty(p_property, p_value) {
767 setElementProperty(p_property, p_value, calendarId);
769 function getDaysInMonth(year, month) {
770 return [31,((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][month-1];
772 function getDayOfWeek(year, month, day) {
773 var date = new Date(year,month-1,day)
774 return date.getDay();
776 this.clearDate = clearDate;
777 function clearDate() {
778 dateField.value = '';
781 this.setDate = setDate;
782 function setDate(year, month, day) {
784 if (month < 10) {month = '0' + month;}
785 if (day < 10) {day = '0' + day;}
789 var dateString = month+'$sep'+day+'$sep'+year;
793 var dateString = day+'$sep'+month+'$sep'+year;
797 var dateString = year+'$sep'+month+'$sep'+day;
800 dateField.value = dateString;
805 this.changeMonth = changeMonth;
806 function changeMonth(change) {
807 currentMonth += change;
809 if(currentMonth > 12) {
812 } else if(currentMonth < 1) {
816 calendar = document.getElementById(calendarId);
817 calendar.innerHTML = calendarDrawTable();
819 this.changeYear = changeYear;
820 function changeYear(change) {
821 currentYear += change;
823 calendar = document.getElementById(calendarId);
824 calendar.innerHTML = calendarDrawTable();
826 function getCurrentYear() {
827 var year = new Date().getYear();
828 if(year < 1900) year += 1900;
831 function getCurrentMonth() {
832 return new Date().getMonth() + 1;
834 function getCurrentDay() {
835 return new Date().getDate();
837 function calendarDrawTable() {
839 var wstart = $wstart;
841 var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth);
842 var daysInMonth = getDaysInMonth(currentYear, currentMonth);
843 var css_class = null; //CSS class for each day
844 var table = \"<table cellspacing='0' cellpadding='0' border='0'>\";
845 table += \"<tr class='header'>\";
846 table += \" <td colspan='2' class='previous'><a href='javascript:changeCCMonth(-1);'><</a><br><a href='javascript:changeCCYear(-1);'>«</a></td>\";
847 table += \" <td colspan='3' class='title'>\" + months[currentMonth-1] + \"<br>\" + currentYear + \"</td>\";
848 table += \" <td colspan='2' class='next'><a href='javascript:changeCCMonth(1);'>></a><br><a href='javascript:changeCCYear(1);'>»</a></td>\";
851 for (var n=0; n<7; n++)
852 table += \"<th>\" + wdays[(wstart+n)%7]+\"</th>\";
854 for(var week=0; week < 6; week++) {
856 for(var n=0; n < 7; n++) {
857 dayOfWeek = (wstart+n)%7;
858 if(week == 0 && startDayOfWeek == dayOfWeek) {
860 } else if (validDay == 1 && dayOfMonth > daysInMonth) {
864 if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) {
865 css_class = 'current';
866 } else if (dayOfWeek == 0 || dayOfWeek == 6) {
867 css_class = 'weekend';
869 css_class = 'weekday';
871 table += \"<td><a class='\"+css_class+\"' href=\\\"javascript:setCCDate(\"+currentYear+\",\"+currentMonth+\",\"+dayOfMonth+\")\\\">\"+dayOfMonth+\"</a></td>\";
874 table += \"<td class='empty'> </td>\";
879 table += \"<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:hideCC();'>Back</a></td></tr>\";
880 table += \"</table>\";
884 function show(field) {
886 if (dateField == field) {
893 var dateString = new String(dateField.value);
894 var dateParts = dateString.split('$sep');
898 selectedMonth = parseInt(dateParts[0],10);
899 selectedDay = parseInt(dateParts[1],10);
900 selectedYear = parseInt(dateParts[2],10);
904 selectedDay = parseInt(dateParts[0],10);
905 selectedMonth = parseInt(dateParts[1],10);
906 selectedYear = parseInt(dateParts[2],10);
910 selectedYear = parseInt(dateParts[0],10);
911 selectedMonth = parseInt(dateParts[1],10);
912 selectedDay = parseInt(dateParts[2],10);
917 if (!(selectedYear && selectedMonth && selectedDay)) {
918 selectedMonth = getCurrentMonth();
919 selectedDay = getCurrentDay();
920 selectedYear = getCurrentYear();
922 currentMonth = selectedMonth;
923 currentDay = selectedDay;
924 currentYear = selectedYear;
925 if(document.getElementById){
926 calendar = document.getElementById(calendarId);
927 calendar.innerHTML = calendarDrawTable(currentYear, currentMonth);
928 setProperty('display', 'block');
929 var fieldPos = new positionInfo(dateField);
930 var calendarPos = new positionInfo(calendarId);
931 var x = fieldPos.getElementLeft();
932 var y = fieldPos.getElementBottom();
933 setProperty('left', x + 'px');
934 setProperty('top', y + 'px');
936 setElementProperty('display', 'block', 'CCIframe');
937 setElementProperty('left', x + 'px', 'CCIframe');
938 setElementProperty('top', y + 'px', 'CCIframe');
939 setElementProperty('width', calendarPos.getElementWidth() + 'px', 'CCIframe');
940 setElementProperty('height', calendarPos.getElementHeight() + 'px', 'CCIframe');
947 setProperty('display', 'none');
948 setElementProperty('display', 'none', 'CCIframe');
952 this.visible = visible;
956 this.can_hide = can_hide;
960 function date_picker(textField) {
968 function setCCDate(year, month, day) {
969 cC.setDate(year, month, day);
971 function changeCCYear(change) {
972 cC.changeYear(change);
974 function changeCCMonth(change) {
975 cC.changeMonth(change);
977 document.write(\"<iframe id='CCIframe' src='javascript:false;' frameBorder='0' scrolling='no'></iframe>\");
978 document.write(\"<div id='CC'></div>\");
987 echo "\n<script type=\"text/javascript\">\n"
994 if (!function_exists('_vd'))
996 function _vd($mixed, $title = '', $exit = false)
998 // Only the site admin is able to proceed here.
999 echo (!empty($title) ? ($title .':') : '') .'<pre>';