From: Steve Sutton Date: Mon, 28 Nov 2016 21:22:23 +0000 (-0500) Subject: More php updates X-Git-Tag: v1.0.0~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e506b54e8870e1f3d6abdfe2665d995a9d5418ab;p=web%2Fwww.mackinacislandpackage.com.git More php updates More things for php version differences. --- diff --git a/admin/Contact/contact_setup.inc b/admin/Contact/contact_setup.inc index 3c4539b..f66b1c9 100644 --- a/admin/Contact/contact_setup.inc +++ b/admin/Contact/contact_setup.inc @@ -1,4 +1,5 @@ - - * @license + * @author Steve Sutton + * @license */ class administrator extends GLM_DB { - /** - * dataResult - * - * used for storing the data result from query to database - * - * @var mixed - * @access public - */ - var $dataResult; - /** - * table - * - * the table in database to use - * - * @var mixed - * @access public - */ - var $table; - /** - * fields - * - * structured field array - * - * @var mixed - * @access public - */ - var $fields; - /** - * primary_key - * - * PRIMARY KEY for the table (usually id) - * - * @var mixed - * @access public - */ - var $primary_key; - /** - * form_scripts - * - * @var mixed - * @access public - */ - var $form_scripts; - /** - * administrator - * - * constructor of administrator class - * - * @param mixed $config - * @param mixed $DB - * @access public - * @return string - */ - function administrator( $config, &$DB ) - { - $this->dbd =& $DB; - $this->fields = $config['fields']; - $this->table = $config['table']; - $this->primary_key = $config['primary_key']; - } - /** - * list_results - * - * @param mixed $data - * @param mixed $headers - * @access public - * @return string - */ - function list_results($data, $headers) - { - foreach ($this->fields as $field_name => $fields) { - if(!$headers[$field_name]) { - $headers[$field_name] = $fields['title']; - } - } + /** + * dataResult + * + * used for storing the data result from query to database + * + * @var mixed + * @access public + */ + var $dataResult; + /** + * table + * + * the table in database to use + * + * @var mixed + * @access public + */ + var $table; + /** + * fields + * + * structured field array + * + * @var mixed + * @access public + */ + var $fields; + /** + * primary_key + * + * PRIMARY KEY for the table (usually id) + * + * @var mixed + * @access public + */ + var $primary_key; + /** + * form_scripts + * + * @var mixed + * @access public + */ + var $form_scripts; + /** + * administrator + * + * constructor of administrator class + * + * @param mixed $config + * @param mixed $DB + * @access public + * @return string + */ + function administrator( $config, &$DB ) + { + $this->dbd =& $DB; + $this->fields = $config['fields']; + $this->table = $config['table']; + $this->primary_key = $config['primary_key']; + } + /** + * list_results + * + * @param mixed $data + * @param mixed $headers + * @access public + * @return string + */ + function list_results($data, $headers) + { + foreach ($this->fields as $field_name => $fields) { + if(!$headers[$field_name]) { + $headers[$field_name] = $fields['title']; + } + } if ($_REQUEST['start_date']) { $pPart[] = "start_date=".$_REQUEST['start_date']; } @@ -105,18 +105,18 @@ class administrator extends GLM_DB if (is_array($pPart)) { $params = "&".implode("&", $pPart); } - $out = GLM_TOOLBOX::make_data_table($data, 'admin-list-table', $headers, $params); - return $out; - } - /** - * add_form_top - * - * @access public - * @return string - */ - function add_form_top() - { - $out = ' + $out = GLM_TOOLBOX::make_data_table($data, 'admin-list-table', $headers, $params); + return $out; + } + /** + * add_form_top + * + * @access public + * @return string + */ + function add_form_top() + { + $out = ' @@ -124,337 +124,337 @@ class administrator extends GLM_DB - '; - return( $out ); - } - /** - * edit_result - * - * Using form_creator class to build out edit form - * - * @param mixed $data - * @access public - * @return string - */ - function edit_result( $data ) - { - $out = $this->add_form_top(); - $out .= '
- '; - $form =& new form_creator( $this->fields, $data ); - $this->form_scripts =& $form->form_scripts; - $out .= $form->build_form(); - return( $out ); - } - /** - * add_result - * - * Using form_creator class to build out Add form - * - * @param mixed $data - * @access public - * @return string - */ - function add_result( $data = null ) - { - //$out = $this->add_form_top(); - $out .= ' -
'; - $form =& new form_creator( $this->fields, $data ); - $this->form_scripts =& $form->form_scripts; - $out .= $form->build_form(); - return( $out ); - } - /** - * update_result - * - * Update data row in $this->table - * - * @access public - * @return string - */ - function update_result() - { - $query = "update ".$this->table." set "; - foreach( $this->fields as $fields ) - { - if( $fields['name'] != $this->primary_key ) - { - $q_part[$fields['name']] = $fields['name']; - switch( $fields['type'] ) - { - - case "text": - default: - $q_part[$fields['name']] .= " = '".$_POST[$fields['name']]."'"; - break; - } - } - } - $query .= " ".implode( ",", $q_part ); - $query .= " where ".$this->primary_key." = ".$_POST[$this->primary_key]; - if( $this->db_exec( $query ) ) - { - return( true ); - } - else - { - return( false ); - } - } - /** - * delete_result - * - * Delete data row in $this->table - * - * @access public - * @return string - */ - function delete_result() - { - $id = ( $_POST[$this->primary_key] ) ? $_POST[$this->primary_key]: $_GET[$this->primary_key]; - if( $id ) - { - $query = "delete from ".$this->table." where ".$this->primary_key." = $id;"; - if( $this->db_exec( $query ) ) - { - return( true ); - } - else - { - return( false ); - } - } - else - { - return( false ); - } - } - /** - * insert_result - * - * Insert data row into $this->table - * - * @access public - * @return string - */ - function insert_result() - { - $query = "insert into ".$this->table." "; - foreach( $this->fields as $fields ) - { - if( $fields['name'] != $this->primary_key ) - { - //$q_part[$fields['name']] = $fields['name']; - switch( $fields['type'] ) - { - case "radio": - $q_part[$fields['name']] = ( $_POST[$fields['name']] ) ? $_POST[$fields['name']]: "null"; - break; - - case "text": - default: - $q_part[$fields['name']] .= "'".$_POST[$fields['name']]."'"; - break; - } - } - } - $query .= "(".implode(",", array_keys( $q_part ) ).")"; - $query .= " values "; - $query .= "(".implode(",", array_values( $q_part ) ).")"; - if( $this->db_exec( $query ) ) - { - return( true ); - } - else - { - return( false ); - } - } - /** - * page_out - * - * @param mixed $header - * @param mixed $nav - * @param mixed $content - * @access public - * @return string - */ - function page_out( $header, $nav, $content ) - { - $out = administrator::top( $header ); - if( is_array( $nav ) ) - { - ob_start(); - GLM_TOOLBOX::html_nav_table( $nav, 5 ); - $out .= ob_get_contents(); - ob_end_clean(); - } - $out .= $content; - $out .= administrator::footer(); - return( $out ); - } - function member_run_action( &$member, &$package ) - { - $member_id = $_SESSION['auth']['userid']; - $member_name = ( $package->ticket_members[$member_id] ) ? $package->ticket_members[$member_id]:$package->ferry_members[$member_id]; - $out = '

'.$member_name.'

'; - $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; - switch( $Action ) - { - case "Edit": - $out .= $member->edit_member( $_GET['id'] ); - break; - - case "Update": - $out .= $member->update_member( $_POST['id'] ); - header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Members'); - exit(); - break; - - default: - $out .= $package->view_member_report(); - break; - } - return( $out ); - } - /** - * admin_run_action - * - * @param mixed $member - * @param mixed $package - * @access public - * @return string - */ - function admin_run_action( &$member, &$package ) - { - $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; - switch( $Action ) - { - case "Edit": - $out .= $member->edit_member( $_GET['id'] ); - break; - - case "Update": - $out .= $member->update_member( $_POST['id'] ); - header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Members'); - exit(); - break; - - case "Remove": - break; - - case "Delete": - break; - - case "Add": - break; - - case "Insert": - break; - - case "View Package": - $out .= $package->view_package( $_GET['id'] ); - break; - - case "Delete Package": - $out .= $package->delete_package( $_GET['id'] ); - header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Packages'); - exit(); - break; - - case "Edit Package": - $out .= $package->edit_package( $_GET['id'] ); - break; - - case "Update Package": - $out .= $package->update_package( $_POST['id'] ); - header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Packages'); - exit(); - break; - - case "List Members": - $out .= $member->get_member_list(); - break; - - case "List Confirmed": - $out .= $package->get_confirmed_list(); - break; - - case "List Deleted": - $out .= $package->get_deleted_list(); - break; - - case "List Packages": - $out .= $package->get_package_list(1); - break; - - case "Summary Report": - $out .= $package->get_summary_report(); - break; - - case "Voucher Reciepts": - $out .= $package->voucher_reciepts(); - break; - - case "List Vouchers": - $out .= $package->list_vouchers(); - break; - - case "Approve Vouchers": - $out .= $package->approve_vouchers(); - if( $package->return_page ) - { - header('Location: '.$package->return_page);//$GLOBALS["PHP_SELF"].'?Action=Voucher+Reciepts'); - exit(); - } - break; - - case "Print Voucher": - $package->print_pdf(); - exit(); - break; - - case "Ferry Vouchers": - $out .= $package->ferry_vouchers(); - break; - - case "Settlement Report": - $out .= $package->settlement_report(); - break; - - case "Update Settlement": - $package->update_settlement(); - $out .= $package->settlement_report(); - break; - - default: - $out .= $package->get_package_list(1); - break; - - } - return( $out ); - } - - /** - * top - * - * @param mixed $message - * @access public - * @return string - */ - function top( $message ) - { - $out = ' - - - - Untitled - - + '; + return( $out ); + } + /** + * edit_result + * + * Using form_creator class to build out edit form + * + * @param mixed $data + * @access public + * @return string + */ + function edit_result( $data ) + { + $out = $this->add_form_top(); + $out .= ' +
'; + $form = new form_creator( $this->fields, $data ); + $this->form_scripts =& $form->form_scripts; + $out .= $form->build_form(); + return( $out ); + } + /** + * add_result + * + * Using form_creator class to build out Add form + * + * @param mixed $data + * @access public + * @return string + */ + function add_result( $data = null ) + { + //$out = $this->add_form_top(); + $out .= ' +
'; + $form = new form_creator( $this->fields, $data ); + $this->form_scripts =& $form->form_scripts; + $out .= $form->build_form(); + return( $out ); + } + /** + * update_result + * + * Update data row in $this->table + * + * @access public + * @return string + */ + function update_result() + { + $query = "update ".$this->table." set "; + foreach( $this->fields as $fields ) + { + if( $fields['name'] != $this->primary_key ) + { + $q_part[$fields['name']] = $fields['name']; + switch( $fields['type'] ) + { + + case "text": + default: + $q_part[$fields['name']] .= " = '".$_POST[$fields['name']]."'"; + break; + } + } + } + $query .= " ".implode( ",", $q_part ); + $query .= " where ".$this->primary_key." = ".$_POST[$this->primary_key]; + if( $this->db_exec( $query ) ) + { + return( true ); + } + else + { + return( false ); + } + } + /** + * delete_result + * + * Delete data row in $this->table + * + * @access public + * @return string + */ + function delete_result() + { + $id = ( $_POST[$this->primary_key] ) ? $_POST[$this->primary_key]: $_GET[$this->primary_key]; + if( $id ) + { + $query = "delete from ".$this->table." where ".$this->primary_key." = $id;"; + if( $this->db_exec( $query ) ) + { + return( true ); + } + else + { + return( false ); + } + } + else + { + return( false ); + } + } + /** + * insert_result + * + * Insert data row into $this->table + * + * @access public + * @return string + */ + function insert_result() + { + $query = "insert into ".$this->table." "; + foreach( $this->fields as $fields ) + { + if( $fields['name'] != $this->primary_key ) + { + //$q_part[$fields['name']] = $fields['name']; + switch( $fields['type'] ) + { + case "radio": + $q_part[$fields['name']] = ( $_POST[$fields['name']] ) ? $_POST[$fields['name']]: "null"; + break; + + case "text": + default: + $q_part[$fields['name']] .= "'".$_POST[$fields['name']]."'"; + break; + } + } + } + $query .= "(".implode(",", array_keys( $q_part ) ).")"; + $query .= " values "; + $query .= "(".implode(",", array_values( $q_part ) ).")"; + if( $this->db_exec( $query ) ) + { + return( true ); + } + else + { + return( false ); + } + } + /** + * page_out + * + * @param mixed $header + * @param mixed $nav + * @param mixed $content + * @access public + * @return string + */ + function page_out( $header, $nav, $content ) + { + $out = administrator::top( $header ); + if( is_array( $nav ) ) + { + ob_start(); + GLM_TOOLBOX::html_nav_table( $nav, 5 ); + $out .= ob_get_contents(); + ob_end_clean(); + } + $out .= $content; + $out .= administrator::footer(); + return( $out ); + } + function member_run_action( &$member, &$package ) + { + $member_id = $_SESSION['auth']['userid']; + $member_name = ( $package->ticket_members[$member_id] ) ? $package->ticket_members[$member_id]:$package->ferry_members[$member_id]; + $out = '

'.$member_name.'

'; + $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; + switch( $Action ) + { + case "Edit": + $out .= $member->edit_member( $_GET['id'] ); + break; + + case "Update": + $out .= $member->update_member( $_POST['id'] ); + header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Members'); + exit(); + break; + + default: + $out .= $package->view_member_report(); + break; + } + return( $out ); + } + /** + * admin_run_action + * + * @param mixed $member + * @param mixed $package + * @access public + * @return string + */ + function admin_run_action( &$member, &$package ) + { + $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; + switch( $Action ) + { + case "Edit": + $out .= $member->edit_member( $_GET['id'] ); + break; + + case "Update": + $out .= $member->update_member( $_POST['id'] ); + header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Members'); + exit(); + break; + + case "Remove": + break; + + case "Delete": + break; + + case "Add": + break; + + case "Insert": + break; + + case "View Package": + $out .= $package->view_package( $_GET['id'] ); + break; + + case "Delete Package": + $out .= $package->delete_package( $_GET['id'] ); + header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Packages'); + exit(); + break; + + case "Edit Package": + $out .= $package->edit_package( $_GET['id'] ); + break; + + case "Update Package": + $out .= $package->update_package( $_POST['id'] ); + header('Location: '.$GLOBALS["PHP_SELF"].'?Action=List+Packages'); + exit(); + break; + + case "List Members": + $out .= $member->get_member_list(); + break; + + case "List Confirmed": + $out .= $package->get_confirmed_list(); + break; + + case "List Deleted": + $out .= $package->get_deleted_list(); + break; + + case "List Packages": + $out .= $package->get_package_list(1); + break; + + case "Summary Report": + $out .= $package->get_summary_report(); + break; + + case "Voucher Reciepts": + $out .= $package->voucher_reciepts(); + break; + + case "List Vouchers": + $out .= $package->list_vouchers(); + break; + + case "Approve Vouchers": + $out .= $package->approve_vouchers(); + if( $package->return_page ) + { + header('Location: '.$package->return_page);//$GLOBALS["PHP_SELF"].'?Action=Voucher+Reciepts'); + exit(); + } + break; + + case "Print Voucher": + $package->print_pdf(); + exit(); + break; + + case "Ferry Vouchers": + $out .= $package->ferry_vouchers(); + break; + + case "Settlement Report": + $out .= $package->settlement_report(); + break; + + case "Update Settlement": + $package->update_settlement(); + $out .= $package->settlement_report(); + break; + + default: + $out .= $package->get_package_list(1); + break; + + } + return( $out ); + } + + /** + * top + * + * @param mixed $message + * @access public + * @return string + */ + function top( $message ) + { + $out = ' + + + + Untitled + + @@ -470,12 +470,12 @@ class administrator extends GLM_DB - - - - + + + + - + */ $out .= ' @@ -483,28 +483,28 @@ $out .= ' - - -

'.$message.'

-
- '.$help_guide.' - '; - return( $out ); - } - /** - * footer - * - * @access public - * @return string - */ - function footer() - { - return( '
- - ' ); - } + + +

'.$message.'

+
+ '.$help_guide.' + '; + return( $out ); + } + /** + * footer + * + * @access public + * @return string + */ + function footer() + { + return( '
+ + ' ); + } } ?> diff --git a/classes/class_members.inc b/classes/class_members.inc index 594fa48..654868a 100755 --- a/classes/class_members.inc +++ b/classes/class_members.inc @@ -1,66 +1,66 @@ - * @license + * @author Steve Sutton + * @license */ -class glm_member extends GLM_TOOLBOX +class glm_member extends GLM_TOOLBOX { /** - * DB - * + * DB + * * @var mixed * @access public */ var $DB; /** - * content - * + * content + * * @var mixed * @access public */ var $content; /** - * toolbox - * + * toolbox + * * @var mixed * @access public */ var $toolbox; /** - * administrator - * + * administrator + * * @var mixed * @access public */ var $administrator; /** - * glm_member - * - * @param mixed $DB - * @param mixed $config + * glm_member + * + * @param mixed $DB + * @param mixed $config * @access public * @return string */ function glm_member( &$DB, $config ) { - $this->DB =& $DB; - $this->administrator =& new administrator( $config, &$DB->dbd ); + $this->DB = $DB; + $this->administrator = new administrator( $config, $DB->dbd ); } /** - * get_member_list - * + * get_member_list + * * @access public * @return string */ @@ -98,11 +98,11 @@ class glm_member extends GLM_TOOLBOX */ return( $out ); } - + /** - * edit_member - * - * @param mixed $id + * edit_member + * + * @param mixed $id * @access public * @return string */ @@ -133,9 +133,9 @@ class glm_member extends GLM_TOOLBOX } /** - * update_member - * - * @param mixed $id + * update_member + * + * @param mixed $id * @access public * @return string */ diff --git a/classes/class_package.inc b/classes/class_package.inc index 8a77e21..45f9e9e 100755 --- a/classes/class_package.inc +++ b/classes/class_package.inc @@ -1,1390 +1,1390 @@ DB =& $DB; - $this->administrator =& new administrator( $config, &$DB->dbd ); - $this->package_prices = $this->get_package_prices(); - $this->ticket_members = $this->get_ticket_members(); - $this->ferry_members = $this->get_ferry_members(); - $this->get_voucher_members(); - $this->package_status = $this->get_package_status(); - } + var $DB; + var $content; + var $toolbox; + var $administrator; + var $package_prices; + var $ticket_members; + var $ferry_members; + var $package_status; + var $pdf_vouchers; + var $return_page; + function package( &$DB, $config ) + { + $this->DB = $DB; + $this->administrator = new administrator( $config, $DB->dbd ); + $this->package_prices = $this->get_package_prices(); + $this->ticket_members = $this->get_ticket_members(); + $this->ferry_members = $this->get_ferry_members(); + $this->get_voucher_members(); + $this->package_status = $this->get_package_status(); + } - function get_voucher_members() - { - $this->pdf_vouchers[4] = $this->ticket_members[4].' Voucher'; - $this->pdf_vouchers[7] = $this->ticket_members[7].' Voucher'; - $carriage = $this->ticket_members[5].'/'.$this->ticket_members[6]; - $this->pdf_vouchers[6] = $carriage.' Voucher'; - $boat = implode("/", $this->ferry_members ); - $this->pdf_vouchers[1] = $boat.' Voucher'; - } + function get_voucher_members() + { + $this->pdf_vouchers[4] = $this->ticket_members[4].' Voucher'; + $this->pdf_vouchers[7] = $this->ticket_members[7].' Voucher'; + $carriage = $this->ticket_members[5].'/'.$this->ticket_members[6]; + $this->pdf_vouchers[6] = $carriage.' Voucher'; + $boat = implode("/", $this->ferry_members ); + $this->pdf_vouchers[1] = $boat.' Voucher'; + } - function print_pdf() - { - include_once(BASE."classes/class_voucher.inc"); - $address_x = 113; - $address_y = (float)605.39; - $summary_y = (float)750.59; - $summary_x = (float)325.25; - $line1_y = (float)500.00; - $line2_y = (float)((float)$line1_y - (float)124.74); - $line3_y = (float)((float)$line2_y - (float)124.74); - $line4_y = (float)((float)$line3_y - (float)124.74); - $pdf =& new Creport(array(0,0,595.35,785.295),'portrait'); // page size - $pdf->selectFont(BASE."fonts/Helvetica.afm"); // page font - $pdf->ezSetMargins(0,0,30,30); // page margins (top,bottom,left,right) - $type_array = array('adult'=>'Adult','youth'=>'Youth','child'=>'Child'); - $query = "select *,to_char(package_date,'MM-DD-YYYY') as package_date from package_req where id = ".$_GET['id']; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - extract( $data[0] ); - } - $billing_address = "$bill_fname $bill_lname\n$bill_address\n$bill_city, $bill_state $bill_zip"; - if( $ship_fname && $ship_lname && $ship_address ) - { - $shipping_address = "$ship_fname $ship_lname\n$ship_address\n$ship_city, $ship_state $ship_zip"; + function print_pdf() + { + include_once(BASE."classes/class_voucher.inc"); + $address_x = 113; + $address_y = (float)605.39; + $summary_y = (float)750.59; + $summary_x = (float)325.25; + $line1_y = (float)500.00; + $line2_y = (float)((float)$line1_y - (float)124.74); + $line3_y = (float)((float)$line2_y - (float)124.74); + $line4_y = (float)((float)$line3_y - (float)124.74); + $pdf = new Creport(array(0,0,595.35,785.295),'portrait'); // page size + $pdf->selectFont(BASE."fonts/Helvetica.afm"); // page font + $pdf->ezSetMargins(0,0,30,30); // page margins (top,bottom,left,right) + $type_array = array('adult'=>'Adult','youth'=>'Youth','child'=>'Child'); + $query = "select *,to_char(package_date,'MM-DD-YYYY') as package_date from package_req where id = ".$_GET['id']; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + extract( $data[0] ); + } + $billing_address = "$bill_fname $bill_lname\n$bill_address\n$bill_city, $bill_state $bill_zip"; + if( $ship_fname && $ship_lname && $ship_address ) + { + $shipping_address = "$ship_fname $ship_lname\n$ship_address\n$ship_city, $ship_state $ship_zip"; // check on shipping zip if there a canadian zip then let's put CANADA on bottom of address $checkZip = str_replace("-","",$ship_zip); if (!is_numeric($checkZip)) { - $shipping_address .= "\nCANADA"; + $shipping_address .= "\nCANADA"; } - } - else - { - $shipping_address = $billing_address; + } + else + { + $shipping_address = $billing_address; // check on shipping zip if there a canadian zip then let's put CANADA on bottom of address $checkZip = str_replace("-","",$bill_zip); if (!is_numeric($checkZip)) { - $shipping_address .= "\nCANADA"; + $shipping_address .= "\nCANADA"; } - } - if( !in_array( $ship_type, array('mackinawcity','stignace') ) ) - { - if( $ship_same == 't' ) - { - $address = $billing_address; - } - else - { - $address = $shipping_address; - } - $directions = "Mailed"; - } - else - { - if( $ship_type == 'mackinawcity' ) - { - // $address = "Mackinac State Historic Parks Office\n207 W. Sinclair Avenue\nMackinaw City, MI 49701"; - $directions = "Pick up at Colonial Michilimackinac Visitors Center"; - } - if( $ship_type == 'stignace' ) - { - // $address = "St. Ignace Chamber of Commerce\n560 N. State Street\nSt. Ignace, MI 49781"; - $directions = "Pick up at St. Ignace Chamber of Commerce"; - } - } - $pdf->ezSetY( $address_y ); - $y = $pdf->ezText( $shipping_address,10,array( 'justification'=>'left','left'=>$address_x ) ); + } + if( !in_array( $ship_type, array('mackinawcity','stignace') ) ) + { + if( $ship_same == 't' ) + { + $address = $billing_address; + } + else + { + $address = $shipping_address; + } + $directions = "Mailed"; + } + else + { + if( $ship_type == 'mackinawcity' ) + { + // $address = "Mackinac State Historic Parks Office\n207 W. Sinclair Avenue\nMackinaw City, MI 49701"; + $directions = "Pick up at Colonial Michilimackinac Visitors Center"; + } + if( $ship_type == 'stignace' ) + { + // $address = "St. Ignace Chamber of Commerce\n560 N. State Street\nSt. Ignace, MI 49781"; + $directions = "Pick up at St. Ignace Chamber of Commerce"; + } + } + $pdf->ezSetY( $address_y ); + $y = $pdf->ezText( $shipping_address,10,array( 'justification'=>'left','left'=>$address_x ) ); + + $pdf->ezSetY( $summary_y ); + $yStart = $pdf->ezText('Package #'.$package_number.' Package Date '.$package_date.'',10,array('justification'=>'left','left'=>$summary_x)); + $yStart = $pdf->ezText(''.$bill_lname.'',10,array('justification'=>'left','left'=>$summary_x)); + $yStart = $pdf->ezText($directions,10,array('justification'=>'left','left'=>$summary_x)); + //$yStart = $pdf->ezText('Summary Sheet',10,array('justification'=>'left','left'=>$summary_x)); + // $yStart -= 15; + // $pdf->line(30,$yStart - 2, 505, $yStart - 2 ); // (x1,y2,x1,y2) + // $pdf->ezSetY( $yStart ); + /* + if( $ship_type == 'mail' ) + { + $ship = 't'; + $y = $pdf->ezText( 'Ship To:',8 ); + } + if( $ship_type == 'overnight' ) + { + $ship = 't'; + $y = $pdf->ezText( 'Over Night To:',8 ); + } + if( $ship_type == 'mackinawcity' ) + { + $ship = 'f'; + $y = $pdf->ezText( 'Will Call Mackinaw City',8 ); + } + if( $ship_type == 'stignace' ) + { + $ship = 'f'; + $y = $pdf->ezText( 'Will Call St. Ignace',8 ); + } + */ + /* + echo '
';
+        print_r( $data );
+        print_r( $address );
+        echo '
'; + exit(); + */ + $pdf->ezSetY( $yStart ); + foreach( $type_array as $type => $title ) + { + if( ${$type} > 0 ) + { + $price_data[$type]['Type'] = $title; + $price_data[$type]['Qty'] = ${$type}; + $price_data[$type]['Price'] = '$'.number_format((float)((float)${$type.'_price'} * ${$type} ),2); + } + } + // $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'right')); + // $options = array('showLines'=>1,'shaded'=>2,'xPos'=>390,'fontSize'=>8,'width'=>100,'cols'=>$cols); + // $y2 = $pdf->ezTable( $price_data,'','',$options ); + /* + */ + // $pdf->setStrokeColor(0,0,0); + // $pdf->line(30,$y2 - 2, 505, $y2 - 2 ); // (x1,y2,x1,y2) + // $pdf->ezSetY( $yStart ); + // unset($price_data); + // handling fee part + $price_data['handling_fee']['Type'] = 'Handling Fee'; + $price_data['handling_fee']['Price'] = '$'.number_format((float)$handling_fee ,2); + // over night fee part + if( $overnight > 0 ) + { + $price_data['overnight']['Type'] = 'Overnight Fee'; + $price_data['overnight']['Price'] = '$'.number_format((float)$overnight ,2); + } + // total part + $price_data['total']['Type'] = 'Total'; + $price_data['total']['Price'] = '$'.number_format((float)$total_package_price ,2); + $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'left')); + $options = array('showHeadings'=>0,'showLines'=>0,'shaded'=>0,'xPos'=>430,'fontSize'=>8,'width'=>150,'cols'=>$cols); + $y = $pdf->ezTable( $price_data,'','',$options ); + + // $pdf->ezSetY( $y2 ); +// echo '
';
+//      print_r( $this );
+//      echo '
'; +// exit(); + // print out vouchers + $line = 1; + foreach( $this->pdf_vouchers as $member_id => $ticket_member ) + { + $query = "select voucher_text from ticket_member where id = ".$member_id; + if( $voucher_data = $this->DB->db_auto_get_data( $query ) ) + { + $c_data['voucher_text'] = $voucher_data[0]['voucher_text']; + } + $c_data['ticket_member'] = $ticket_member; + $c_data['package_number'] = $package_number; + $c_data['package_date'] = $package_date; + $c_data['name'] = $bill_fname.' '.$bill_lname; + $c_data['address'] = $bill_address; + $c_data['city'] = $bill_city; + $c_data['zip'] = $bill_zip; + foreach( $type_array as $type => $title ) + { + if( ${$type} > 0 ) + { + $t_data[$type]['Type'] = $title; + $t_data[$type]['qty'] = ${$type}; + } + } + $barcode = ( $member_id == 7 ) ? true: false; + $y = $this->pdf_voucher( $pdf, $c_data, $t_data, ${'line'.$line.'_y'}, $barcode ); + $line++; + } + //$pdf->addPngFromFile('../../images/logo.png',30,220,150); + //$y = $pdf->ezText("Mackinac Island Carriage Tours,Inc.\nP.O. Box 400\nMackinac Island, MI 49757\n\n"); + //$pdf->ezStopPageNumbers(1,1); + $output_options['Content-Disposition'] = "MAVB_pack.pdf"; + $pdf->ezStream($output_options); + } + + function pdf_voucher( &$pdf, $c_data, $t_data, $line_y, $barcode = false ) + { + // $pdf->setLineStyle(1,'','',array(20,5,10,5)); + // $pdf->setStrokeColor(0,0,0); + // $y = $pdf->line(30,$y - 2, 555, $y - 2 ); // (x1,y2,x1,y2) + //$pdf->setLineStyle(1,'','',''); + $pdf->ezSetY( $line_y ); + //$yStart = $pdf->ezText(str_repeat("-",88)."\n",10); + $yStart = $pdf->ezText("\n",10); + $y = $pdf->ezText($c_data['package_date'].' Package # '.$c_data['package_number'],10,array('justification'=>'right','right'=>10)); + $yTableStart = $y; + $pdf->ezSetY( $yStart ); + $y = $pdf->ezText( $c_data['ticket_member'],10 ); + $pdf->setLineStyle(1,'','',''); + $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'right')); + $options = array('showHeadings'=>0,'showLines'=>0,'shaded'=>0,'xPos'=>190,'fontSize'=>10,'width'=>150,'cols'=>$cols); + // $y1 = $pdf->ezText( "\n",10 ); + // $y2 = $pdf->ezText( "\n",10 ); + // $y = $pdf->ezText( 'Package Number '.$c_data['package_number'].' ',10,array('aleft'=>390) ); + // $pdf->ezSetY( $y2 ); + $y = $pdf->ezText("\n".$c_data['name'],10); + $y = $pdf->ezText($c_data['address'],10); + $y = $pdf->ezText($c_data['city'].', '.$c_data['state'].' '.$c_data['zip']."\n",10); + $y = $pdf->ezText('Mackinac Island Experience Package',10); + $pdf->ezSetY( $yTableStart - 5 ); + $y = $pdf->ezText($c_data['voucher_text'],8,array( 'justification'=>'left','left'=>210 )); + if( $barcode == true ) + { + $pdf->addJpegFromFile('./fort_voucher.jpg',400,$line_y - 120,160); + } + $pdf->ezSetY( $yTableStart ); + $y = $pdf->ezTable( $t_data,'','',$options ); + // adding voucher text from ticket_member data + // $y = $pdf->ezText("\n\n\n",10); + // $pdf->ezSetY( $y2 ); + // $y1 = $pdf->ezText( "\n\n\n\n",10 ); + return( $y ); + } + + function get_package_status() + { + $query = "select * from package_status order by id"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + foreach( $data as $row ) + { + $out_array[$row['id']] = $row['name']; + } + } + return( $out_array ); + } - $pdf->ezSetY( $summary_y ); - $yStart = $pdf->ezText('Package #'.$package_number.' Package Date '.$package_date.'',10,array('justification'=>'left','left'=>$summary_x)); - $yStart = $pdf->ezText(''.$bill_lname.'',10,array('justification'=>'left','left'=>$summary_x)); - $yStart = $pdf->ezText($directions,10,array('justification'=>'left','left'=>$summary_x)); - //$yStart = $pdf->ezText('Summary Sheet',10,array('justification'=>'left','left'=>$summary_x)); - // $yStart -= 15; - // $pdf->line(30,$yStart - 2, 505, $yStart - 2 ); // (x1,y2,x1,y2) - // $pdf->ezSetY( $yStart ); - /* - if( $ship_type == 'mail' ) - { - $ship = 't'; - $y = $pdf->ezText( 'Ship To:',8 ); - } - if( $ship_type == 'overnight' ) - { - $ship = 't'; - $y = $pdf->ezText( 'Over Night To:',8 ); - } - if( $ship_type == 'mackinawcity' ) - { - $ship = 'f'; - $y = $pdf->ezText( 'Will Call Mackinaw City',8 ); - } - if( $ship_type == 'stignace' ) - { - $ship = 'f'; - $y = $pdf->ezText( 'Will Call St. Ignace',8 ); - } - */ - /* - echo '
';
-		print_r( $data );
-		print_r( $address );
-		echo '
'; - exit(); - */ - $pdf->ezSetY( $yStart ); - foreach( $type_array as $type => $title ) - { - if( ${$type} > 0 ) - { - $price_data[$type]['Type'] = $title; - $price_data[$type]['Qty'] = ${$type}; - $price_data[$type]['Price'] = '$'.number_format((float)((float)${$type.'_price'} * ${$type} ),2); - } - } - // $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'right')); - // $options = array('showLines'=>1,'shaded'=>2,'xPos'=>390,'fontSize'=>8,'width'=>100,'cols'=>$cols); - // $y2 = $pdf->ezTable( $price_data,'','',$options ); - /* - */ - // $pdf->setStrokeColor(0,0,0); - // $pdf->line(30,$y2 - 2, 505, $y2 - 2 ); // (x1,y2,x1,y2) - // $pdf->ezSetY( $yStart ); - // unset($price_data); - // handling fee part - $price_data['handling_fee']['Type'] = 'Handling Fee'; - $price_data['handling_fee']['Price'] = '$'.number_format((float)$handling_fee ,2); - // over night fee part - if( $overnight > 0 ) - { - $price_data['overnight']['Type'] = 'Overnight Fee'; - $price_data['overnight']['Price'] = '$'.number_format((float)$overnight ,2); - } - // total part - $price_data['total']['Type'] = 'Total'; - $price_data['total']['Price'] = '$'.number_format((float)$total_package_price ,2); - $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'left')); - $options = array('showHeadings'=>0,'showLines'=>0,'shaded'=>0,'xPos'=>430,'fontSize'=>8,'width'=>150,'cols'=>$cols); - $y = $pdf->ezTable( $price_data,'','',$options ); + function list_vouchers() + { + $out = $this->ferry_vouchers(); + $prices = $this->package_prices[$this->ferry_members[$_GET['ferry']]]; + $adult_price = $prices['adult']; + $youth_price = $prices['youth']; + $child_price = $prices['child']; + $adult = $youth = $child = 0; + $query = "select package_number,adult,youth,child from package_req where ferry_id = ".$_GET['ferry']; + //echo '

'.$query.'

'; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + $out .= '
+ + + + + + + + + + + + '; + foreach( $data as $row ) + { + $adult += $row['adult']; + $youth += $row['youth']; + $child += $row['child']; + $out .= ' + + + + + + + + '; + } + $out .= ' + + + + + + + + '; + $out .= '
'.$this->ferry_members[$_GET['ferry']].'
Package #AdultAdult PriceYouthYouth PriceChildChild Price
'.$row['package_number'].''.$row['adult'].'$'.( number_format( $row['adult'] * $adult_price , 2 ) ) .''.$row['youth'].'$'.( number_format( $row['youth'] * $youth_price , 2 ) ).''.$row['child'].'$'.( number_format( $row['child'] * $child_price , 2 ) ).'
Totals'. $adult.'$'.( number_format( $adult * $adult_price , 2 ) ) .''. $youth.'$'.( number_format( $youth * $youth_price , 2 ) ).''. $child.'$'.( number_format( $child * $child_price , 2 ) ).'
'; + } + else + { + $out .= '

No Vouchers to show

'; + } + //echo '
';
+            //  print_r( $this );
+            //echo '
'; + return( $out ); + } - // $pdf->ezSetY( $y2 ); -// echo '
';
-//		print_r( $this );
-//		echo '
'; -// exit(); - // print out vouchers - $line = 1; - foreach( $this->pdf_vouchers as $member_id => $ticket_member ) - { - $query = "select voucher_text from ticket_member where id = ".$member_id; - if( $voucher_data = $this->DB->db_auto_get_data( $query ) ) - { - $c_data['voucher_text'] = $voucher_data[0]['voucher_text']; - } - $c_data['ticket_member'] = $ticket_member; - $c_data['package_number'] = $package_number; - $c_data['package_date'] = $package_date; - $c_data['name'] = $bill_fname.' '.$bill_lname; - $c_data['address'] = $bill_address; - $c_data['city'] = $bill_city; - $c_data['zip'] = $bill_zip; - foreach( $type_array as $type => $title ) - { - if( ${$type} > 0 ) - { - $t_data[$type]['Type'] = $title; - $t_data[$type]['qty'] = ${$type}; - } - } - $barcode = ( $member_id == 7 ) ? true: false; - $y = $this->pdf_voucher( &$pdf, $c_data, $t_data, ${'line'.$line.'_y'}, $barcode ); - $line++; - } - //$pdf->addPngFromFile('../../images/logo.png',30,220,150); - //$y = $pdf->ezText("Mackinac Island Carriage Tours,Inc.\nP.O. Box 400\nMackinac Island, MI 49757\n\n"); - //$pdf->ezStopPageNumbers(1,1); - $output_options['Content-Disposition'] = "MAVB_pack.pdf"; - $pdf->ezStream($output_options); - } + function approve_vouchers() + { + // echo '
';
+    //  print_r( $_POST );
+    //  echo '
'; + $error = ''; + if( $_POST['ferry'] == '' ) + { + $error_ar[] = 'ferry'; + } + if( $_POST['vouchers'] == '' ) + { + $error_ar[] = 'vouchers'; + } + if( is_array( $error_ar ) ) + { + if( $_POST['ferry'] ) + { + $params[] = 'ferry='.$_POST['ferry']; + } + if( $_POST['vouchers'] ) + { + $params[] = 'vouchers='.urlencode($_POST['vouchers']); + } + if( is_array( $params ) ) + { + $pars = implode("&",$params); + } + $this->return_page = $GLOBALS["PHP_SELF"].'?Action=Voucher+Reciepts&error='.implode("|",$error_ar).'&'.$pars; + return( false ); + } + // when approving package_numbers for ferry boat vouchers + // need to make sure that if they already are marked with ferry_id then they don't get overwritten + // + $this->DB->db_exec( "prepare update_package( int, int ) as update package_req set ferry_id = $1 where package_number = $2" ); + $vouchers = explode("\n",$_POST['vouchers']); + if( is_array( $vouchers ) ) + { + foreach( $vouchers as $package_number ) + { + $package_number = trim( $package_number ); + if( $package_number != '' && is_numeric( $package_number ) ) + { + $query = "execute update_package( ".$_POST['ferry'].", $package_number )"; + // echo '

'.$query.'

'; + $this->DB->db_exec( $query ); + } + } + } + $out = $this->ferry_vouchers(); + $out .= '

Updated Records

'; + //$this->return_page = $GLOBALS["PHP_SELF"].'?Action=Ferry+Vouchers'; + return( $out ); + } - function pdf_voucher( &$pdf, $c_data, $t_data, $line_y, $barcode = false ) - { - // $pdf->setLineStyle(1,'','',array(20,5,10,5)); - // $pdf->setStrokeColor(0,0,0); - // $y = $pdf->line(30,$y - 2, 555, $y - 2 ); // (x1,y2,x1,y2) - //$pdf->setLineStyle(1,'','',''); - $pdf->ezSetY( $line_y ); - //$yStart = $pdf->ezText(str_repeat("-",88)."\n",10); - $yStart = $pdf->ezText("\n",10); - $y = $pdf->ezText($c_data['package_date'].' Package # '.$c_data['package_number'],10,array('justification'=>'right','right'=>10)); - $yTableStart = $y; - $pdf->ezSetY( $yStart ); - $y = $pdf->ezText( $c_data['ticket_member'],10 ); - $pdf->setLineStyle(1,'','',''); - $cols = array('Price'=>array('justification'=>'right'),'Qty'=>array('justification'=>'right'),'Type'=>array('justification'=>'right')); - $options = array('showHeadings'=>0,'showLines'=>0,'shaded'=>0,'xPos'=>190,'fontSize'=>10,'width'=>150,'cols'=>$cols); - // $y1 = $pdf->ezText( "\n",10 ); - // $y2 = $pdf->ezText( "\n",10 ); - // $y = $pdf->ezText( 'Package Number '.$c_data['package_number'].' ',10,array('aleft'=>390) ); - // $pdf->ezSetY( $y2 ); - $y = $pdf->ezText("\n".$c_data['name'],10); - $y = $pdf->ezText($c_data['address'],10); - $y = $pdf->ezText($c_data['city'].', '.$c_data['state'].' '.$c_data['zip']."\n",10); - $y = $pdf->ezText('Mackinac Island Experience Package',10); - $pdf->ezSetY( $yTableStart - 5 ); - $y = $pdf->ezText($c_data['voucher_text'],8,array( 'justification'=>'left','left'=>210 )); - if( $barcode == true ) - { - $pdf->addJpegFromFile('./fort_voucher.jpg',400,$line_y - 120,160); - } - $pdf->ezSetY( $yTableStart ); - $y = $pdf->ezTable( $t_data,'','',$options ); - // adding voucher text from ticket_member data - // $y = $pdf->ezText("\n\n\n",10); - // $pdf->ezSetY( $y2 ); - // $y1 = $pdf->ezText( "\n\n\n\n",10 ); - return( $y ); - } - - function get_package_status() - { - $query = "select * from package_status order by id"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - foreach( $data as $row ) - { - $out_array[$row['id']] = $row['name']; - } - } - return( $out_array ); - } - - function list_vouchers() - { - $out = $this->ferry_vouchers(); - $prices = $this->package_prices[$this->ferry_members[$_GET['ferry']]]; - $adult_price = $prices['adult']; - $youth_price = $prices['youth']; - $child_price = $prices['child']; - $adult = $youth = $child = 0; - $query = "select package_number,adult,youth,child from package_req where ferry_id = ".$_GET['ferry']; - //echo '

'.$query.'

'; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - $out .= ' - - - - - - - - - - - - '; - foreach( $data as $row ) - { - $adult += $row['adult']; - $youth += $row['youth']; - $child += $row['child']; - $out .= ' - - - - - - - - '; - } - $out .= ' - - - - - - - - '; - $out .= '
'.$this->ferry_members[$_GET['ferry']].'
Package #AdultAdult PriceYouthYouth PriceChildChild Price
'.$row['package_number'].''.$row['adult'].'$'.( number_format( $row['adult'] * $adult_price , 2 ) ) .''.$row['youth'].'$'.( number_format( $row['youth'] * $youth_price , 2 ) ).''.$row['child'].'$'.( number_format( $row['child'] * $child_price , 2 ) ).'
Totals'. $adult.'$'.( number_format( $adult * $adult_price , 2 ) ) .''. $youth.'$'.( number_format( $youth * $youth_price , 2 ) ).''. $child.'$'.( number_format( $child * $child_price , 2 ) ).'
'; - } - else - { - $out .= '

No Vouchers to show

'; - } - //echo '
';
-			//	print_r( $this );
-			//echo '
'; - return( $out ); - } + function voucher_reciepts() + { + if( is_array( $this->ferry_members ) ) + { + $out .= ' + +
'; + } + $out .= ''; + return( $out ); + } - function approve_vouchers() - { - // echo '
';
-	//	print_r( $_POST );
-	//	echo '
'; - $error = ''; - if( $_POST['ferry'] == '' ) - { - $error_ar[] = 'ferry'; - } - if( $_POST['vouchers'] == '' ) - { - $error_ar[] = 'vouchers'; - } - if( is_array( $error_ar ) ) - { - if( $_POST['ferry'] ) - { - $params[] = 'ferry='.$_POST['ferry']; - } - if( $_POST['vouchers'] ) - { - $params[] = 'vouchers='.urlencode($_POST['vouchers']); - } - if( is_array( $params ) ) - { - $pars = implode("&",$params); - } - $this->return_page = $GLOBALS["PHP_SELF"].'?Action=Voucher+Reciepts&error='.implode("|",$error_ar).'&'.$pars; - return( false ); - } - // when approving package_numbers for ferry boat vouchers - // need to make sure that if they already are marked with ferry_id then they don't get overwritten - // - $this->DB->db_exec( "prepare update_package( int, int ) as update package_req set ferry_id = $1 where package_number = $2" ); - $vouchers = explode("\n",$_POST['vouchers']); - if( is_array( $vouchers ) ) - { - foreach( $vouchers as $package_number ) - { - $package_number = trim( $package_number ); - if( $package_number != '' && is_numeric( $package_number ) ) - { - $query = "execute update_package( ".$_POST['ferry'].", $package_number )"; - // echo '

'.$query.'

'; - $this->DB->db_exec( $query ); - } - } - } - $out = $this->ferry_vouchers(); - $out .= '

Updated Records

'; - //$this->return_page = $GLOBALS["PHP_SELF"].'?Action=Ferry+Vouchers'; - return( $out ); - } + function ferry_vouchers() + { + // listing of ferry member vouchers and inputbutton + if( is_array( $this->ferry_members ) ) + { + $out .= '
+ +
'; + } + $out .= '
'; + return( $out ); + } - function voucher_reciepts() - { - if( is_array( $this->ferry_members ) ) - { - $out .= '
- -
'; - } - $out .= ''; - return( $out ); - } + function get_summary_report() + { + // for summary report give + // # of packages sold + // # total amounts per package + // fort mackinac adult youth child + // carriage tours adult youth child + // butterfly adult youth child + // grand hotel adult youth child + // ferry lines + // - Arnold + // - Shepler + // - Starline + // handling and proccessing fees + if( !$_GET['start_date'] ){ + $_GET['start_date'] = date('m/d/Y',mktime(0,0,0,1,1,date('Y'))); + $_GET['end_date'] = date('m/d/Y'); + $_GET['summary_type'] = 'package_date'; + } - function ferry_vouchers() - { - // listing of ferry member vouchers and inputbutton - if( is_array( $this->ferry_members ) ) - { - $out .= '
- -
'; - } - $out .= '
'; - return( $out ); - } + // echo '
';
+    //  print_r( $this );
+    //  echo '
'; + $package_data = $this->get_member_summary(); + $ferry_package_data = $this->get_ferry_summary(); + // echo '
';
+    //  print_r( $ferry_package_data );
+    //  echo '
'; + $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total_price = $total = 0; + $f_adult = $f_adult_price = $f_youth = $f_youth_price = $f_child = $f_child_price = $f_total = $f_total_price = 0; + foreach( $this->ticket_members as $member_id => $ticket_row ) + { + unset( $t_dat ); + $adult = (int)$package_data[$member_id]['adult']; + $adult_price += (float)$package_data[$member_id]['adult_price']; + $youth = (int)$package_data[$member_id]['youth']; + $youth_price += (float)$package_data[$member_id]['youth_price']; + $child = (int)$package_data[$member_id]['child']; + $child_price += (float)$package_data[$member_id]['child_price']; + $total = (int)$package_data[$member_id]['total_packages_sold']; + $t_dat['name'] = $ticket_row; + $t_dat['adult_total'] = $package_data[$member_id]['adult']; + $t_dat['adult_price_total'] = '$'.number_format($package_data[$member_id]['adult_price'],2); + $t_dat['youth_total'] = $package_data[$member_id]['youth']; + $t_dat['youth_price_total'] = '$'.number_format($package_data[$member_id]['youth_price'],2); + $t_dat['child_total'] = $package_data[$member_id]['child']; + $t_dat['child_price_total'] = '$'.number_format($package_data[$member_id]['child_price'],2); + $t_dat['total'] = $package_data[$member_id]['adult_price']; + $member_total_price = (float)$package_data[$member_id]['adult_price']; + $member_total_price += (float)$package_data[$member_id]['youth_price']; + $member_total_price += (float)$package_data[$member_id]['child_price']; + $t_dat['total_price'] = '$'.number_format($member_total_price,2); + $total_price += $member_total_price; + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); + $handling_fee = (float)$package_data[$member_id]['handling_fee']; + $overnight = (float)$package_data[$member_id]['overnight']; + $total_packages = $package_data[$member_id]['total_packages_sold']; + } - function get_summary_report() - { - // for summary report give - // # of packages sold - // # total amounts per package - // fort mackinac adult youth child - // carriage tours adult youth child - // butterfly adult youth child - // grand hotel adult youth child - // ferry lines - // - Arnold - // - Shepler - // - Starline - // handling and proccessing fees - if( !$_GET['start_date'] ){ - $_GET['start_date'] = date('m/d/Y',mktime(0,0,0,1,1,date('Y'))); - $_GET['end_date'] = date('m/d/Y'); - $_GET['summary_type'] = 'package_date'; - } + // need a online ferry total + unset( $dat ); + $adult_price += (float)$ferry_package_data[1]['adult_price']; + $youth_price += (float)$ferry_package_data[1]['youth_price']; + $child_price += (float)$ferry_package_data[1]['child_price']; + $total += (int)$ferry_package_data[1]['total_packages_sold']; + $t_dat['name'] = 'Ferry Lines'; + $t_dat['adult_total'] = $ferry_package_data[1]['adult']; + $t_dat['adult_price_total'] = '$'.number_format($ferry_package_data[1]['adult_price'],2); + $t_dat['youth_total'] = $ferry_package_data[1]['youth']; + $t_dat['youth_price_total'] = '$'.number_format($ferry_package_data[1]['youth_price'],2); + $t_dat['child_total'] = $ferry_package_data[1]['child']; + $t_dat['child_price_total'] = '$'.number_format($ferry_package_data[1]['child_price'],2); + $t_dat['total'] = $ferry_package_data[1]['adult_price']; + $member_total_price = (float)$ferry_package_data[1]['adult_price']; + $member_total_price += (float)$ferry_package_data[1]['youth_price']; + $member_total_price += (float)$ferry_package_data[1]['child_price']; + $t_dat['total_price'] = '$'.number_format($member_total_price,2); + $total_price += $member_total_price; + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - // echo '
';
-	//	print_r( $this );
-	//	echo '
'; - $package_data = $this->get_member_summary(); - $ferry_package_data = $this->get_ferry_summary(); - // echo '
';
-	//	print_r( $ferry_package_data );
-	//	echo '
'; - $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total_price = $total = 0; - $f_adult = $f_adult_price = $f_youth = $f_youth_price = $f_child = $f_child_price = $f_total = $f_total_price = 0; - foreach( $this->ticket_members as $member_id => $ticket_row ) - { - unset( $t_dat ); - $adult = (int)$package_data[$member_id]['adult']; - $adult_price += (float)$package_data[$member_id]['adult_price']; - $youth = (int)$package_data[$member_id]['youth']; - $youth_price += (float)$package_data[$member_id]['youth_price']; - $child = (int)$package_data[$member_id]['child']; - $child_price += (float)$package_data[$member_id]['child_price']; - $total = (int)$package_data[$member_id]['total_packages_sold']; - $t_dat['name'] = $ticket_row; - $t_dat['adult_total'] = $package_data[$member_id]['adult']; - $t_dat['adult_price_total'] = '$'.number_format($package_data[$member_id]['adult_price'],2); - $t_dat['youth_total'] = $package_data[$member_id]['youth']; - $t_dat['youth_price_total'] = '$'.number_format($package_data[$member_id]['youth_price'],2); - $t_dat['child_total'] = $package_data[$member_id]['child']; - $t_dat['child_price_total'] = '$'.number_format($package_data[$member_id]['child_price'],2); - $t_dat['total'] = $package_data[$member_id]['adult_price']; - $member_total_price = (float)$package_data[$member_id]['adult_price']; - $member_total_price += (float)$package_data[$member_id]['youth_price']; - $member_total_price += (float)$package_data[$member_id]['child_price']; - $t_dat['total_price'] = '$'.number_format($member_total_price,2); - $total_price += $member_total_price; - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - $handling_fee = (float)$package_data[$member_id]['handling_fee']; - $overnight = (float)$package_data[$member_id]['overnight']; - $total_packages = $package_data[$member_id]['total_packages_sold']; - } + // sub total line + unset( $dat ); + $dat['name'] = 'Sub Total Amounts'; + $dat['adult_total'] = '';//$adult; + $dat['adult_price_total'] = '$'.number_format($adult_price,2); + $dat['youth_total'] = '';//$youth; + $dat['youth_price_total'] = '$'.number_format($youth_price,2); + $dat['child_total'] = '';//$child; + $dat['child_price_total'] = '$'.number_format($child_price,2); + $dat['total'] = '';//$total; + $dat['total_price'] = '$'.number_format($total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); - // need a online ferry total - unset( $dat ); - $adult_price += (float)$ferry_package_data[1]['adult_price']; - $youth_price += (float)$ferry_package_data[1]['youth_price']; - $child_price += (float)$ferry_package_data[1]['child_price']; - $total += (int)$ferry_package_data[1]['total_packages_sold']; - $t_dat['name'] = 'Ferry Lines'; - $t_dat['adult_total'] = $ferry_package_data[1]['adult']; - $t_dat['adult_price_total'] = '$'.number_format($ferry_package_data[1]['adult_price'],2); - $t_dat['youth_total'] = $ferry_package_data[1]['youth']; - $t_dat['youth_price_total'] = '$'.number_format($ferry_package_data[1]['youth_price'],2); - $t_dat['child_total'] = $ferry_package_data[1]['child']; - $t_dat['child_price_total'] = '$'.number_format($ferry_package_data[1]['child_price'],2); - $t_dat['total'] = $ferry_package_data[1]['adult_price']; - $member_total_price = (float)$ferry_package_data[1]['adult_price']; - $member_total_price += (float)$ferry_package_data[1]['youth_price']; - $member_total_price += (float)$ferry_package_data[1]['child_price']; - $t_dat['total_price'] = '$'.number_format($member_total_price,2); - $total_price += $member_total_price; - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - // sub total line - unset( $dat ); - $dat['name'] = 'Sub Total Amounts'; - $dat['adult_total'] = '';//$adult; - $dat['adult_price_total'] = '$'.number_format($adult_price,2); - $dat['youth_total'] = '';//$youth; - $dat['youth_price_total'] = '$'.number_format($youth_price,2); - $dat['child_total'] = '';//$child; - $dat['child_price_total'] = '$'.number_format($child_price,2); - $dat['total'] = '';//$total; - $dat['total_price'] = '$'.number_format($total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); + /* + // ferry lines totals + foreach( $this->ferry_members as $member_id => $ticket_row ) + { + unset( $t_dat ); + $f_adult += (int)$ferry_package_data[$member_id]['adult']; + $f_adult_price += (float)$ferry_package_data[$member_id]['adult_price']; + $f_youth += (int)$ferry_package_data[$member_id]['youth']; + $f_youth_price += (float)$ferry_package_data[$member_id]['youth_price']; + $f_child += (int)$ferry_package_data[$member_id]['child']; + $f_child_price += (float)$ferry_package_data[$member_id]['child_price']; + $f_total += (int)$ferry_package_data[$member_id]['total_packages_sold']; + $t_dat['name'] = $ticket_row; + $t_dat['adult_total'] = $ferry_package_data[$member_id]['adult']; + $t_dat['adult_price_total'] = '$'.number_format($ferry_package_data[$member_id]['adult_price'],2); + $t_dat['youth_total'] = $ferry_package_data[$member_id]['youth']; + $t_dat['youth_price_total'] = '$'.number_format($ferry_package_data[$member_id]['youth_price'],2); + $t_dat['child_total'] = $ferry_package_data[$member_id]['child']; + $t_dat['child_price_total'] = '$'.number_format($ferry_package_data[$member_id]['child_price'],2); + $t_dat['total'] = $ferry_package_data[$member_id]['adult_price']; + $f_member_total_price = (float)$ferry_package_data[$member_id]['adult_price']; + $f_member_total_price += (float)$ferry_package_data[$member_id]['youth_price']; + $f_member_total_price += (float)$ferry_package_data[$member_id]['child_price']; + $f_total_price += $f_member_total_price; + $t_dat['total_price'] = '$'.number_format($f_member_total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); + } + // sub total line + unset( $dat ); + $dat['name'] = 'Sub Total Amounts(ferry)'; + $dat['adult_total'] = $f_adult; + $dat['adult_price_total'] = '$'.number_format($f_adult_price,2); + $dat['youth_total'] = $f_youth; + $dat['youth_price_total'] = '$'.number_format($f_youth_price,2); + $dat['child_total'] = $f_child; + $dat['child_price_total'] = '$'.number_format($f_child_price,2); + $dat['total'] = $f_total; + $dat['total_price'] = '$'.number_format($f_total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); + // total line + unset( $dat ); + $dat['name'] = 'Total Amounts'; + $dat['adult_total'] = $adult; + $f_adult_price = (float)((float)$adult_price + (float)$f_adult_price); + $dat['adult_price_total'] = '$'.number_format($f_adult_price,2); + $dat['youth_total'] = $youth; + $f_youth_price = (float)((float)$youth_price + (float)$f_youth_price); + $dat['youth_price_total'] = '$'.number_format($f_youth_price,2); + $dat['child_total'] = $child; + $f_child_price = (float)((float)$child_price + (float)$f_child_price); + $dat['child_price_total'] = '$'.number_format($f_child_price,2); + $dat['total'] = $total; + $total_price = (float)((float)$total_price + (float)$f_total_price); + $dat['total_price'] = '$'.number_format( $total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); + */ - /* - // ferry lines totals - foreach( $this->ferry_members as $member_id => $ticket_row ) - { - unset( $t_dat ); - $f_adult += (int)$ferry_package_data[$member_id]['adult']; - $f_adult_price += (float)$ferry_package_data[$member_id]['adult_price']; - $f_youth += (int)$ferry_package_data[$member_id]['youth']; - $f_youth_price += (float)$ferry_package_data[$member_id]['youth_price']; - $f_child += (int)$ferry_package_data[$member_id]['child']; - $f_child_price += (float)$ferry_package_data[$member_id]['child_price']; - $f_total += (int)$ferry_package_data[$member_id]['total_packages_sold']; - $t_dat['name'] = $ticket_row; - $t_dat['adult_total'] = $ferry_package_data[$member_id]['adult']; - $t_dat['adult_price_total'] = '$'.number_format($ferry_package_data[$member_id]['adult_price'],2); - $t_dat['youth_total'] = $ferry_package_data[$member_id]['youth']; - $t_dat['youth_price_total'] = '$'.number_format($ferry_package_data[$member_id]['youth_price'],2); - $t_dat['child_total'] = $ferry_package_data[$member_id]['child']; - $t_dat['child_price_total'] = '$'.number_format($ferry_package_data[$member_id]['child_price'],2); - $t_dat['total'] = $ferry_package_data[$member_id]['adult_price']; - $f_member_total_price = (float)$ferry_package_data[$member_id]['adult_price']; - $f_member_total_price += (float)$ferry_package_data[$member_id]['youth_price']; - $f_member_total_price += (float)$ferry_package_data[$member_id]['child_price']; - $f_total_price += $f_member_total_price; - $t_dat['total_price'] = '$'.number_format($f_member_total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - } - // sub total line - unset( $dat ); - $dat['name'] = 'Sub Total Amounts(ferry)'; - $dat['adult_total'] = $f_adult; - $dat['adult_price_total'] = '$'.number_format($f_adult_price,2); - $dat['youth_total'] = $f_youth; - $dat['youth_price_total'] = '$'.number_format($f_youth_price,2); - $dat['child_total'] = $f_child; - $dat['child_price_total'] = '$'.number_format($f_child_price,2); - $dat['total'] = $f_total; - $dat['total_price'] = '$'.number_format($f_total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); - - // total line - unset( $dat ); - $dat['name'] = 'Total Amounts'; - $dat['adult_total'] = $adult; - $f_adult_price = (float)((float)$adult_price + (float)$f_adult_price); - $dat['adult_price_total'] = '$'.number_format($f_adult_price,2); - $dat['youth_total'] = $youth; - $f_youth_price = (float)((float)$youth_price + (float)$f_youth_price); - $dat['youth_price_total'] = '$'.number_format($f_youth_price,2); - $dat['child_total'] = $child; - $f_child_price = (float)((float)$child_price + (float)$f_child_price); - $dat['child_price_total'] = '$'.number_format($f_child_price,2); - $dat['total'] = $total; - $total_price = (float)((float)$total_price + (float)$f_total_price); - $dat['total_price'] = '$'.number_format( $total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER_SUB,$dat ); - */ - - - // handling and processing total line - // echo '

count:'.$total.'

'; - // echo '

Handling_fee:'.$handling_fee.'

'; - // echo '

OverNight:'.$overnight.'

'; - $handling_processing_fee = number_format((float)((float)$handling_fee + (float)$overnight),2); - unset( $dat ); - $dat['name'] = 'Handling & Processing Fees'; - $dat['adult_total'] = ''; - $dat['adult_price_total'] = ''; - $dat['youth_total'] = ''; - $dat['youth_price_total'] = ''; - $dat['child_total'] = ''; - $dat['child_price_total'] = ''; - $dat['total'] = ''; - $dat['total_price'] = '$'.$handling_processing_fee; - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); + // handling and processing total line - // Grand total line - unset( $dat ); - $dat['name'] = 'Grand Total'; - $dat['adult_total'] = ''; - $dat['adult_price_total'] = ''; - $dat['youth_total'] = ''; - $dat['youth_price_total'] = ''; - $dat['child_total'] = ''; - $dat['child_price_total'] = ''; - $dat['total'] = ''; - $total_price = (float)((float)((float)$handling_fee + (float)$overnight) + (float)$total_price); - $dat['total_price'] = '$'.number_format($total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); + // echo '

count:'.$total.'

'; + // echo '

Handling_fee:'.$handling_fee.'

'; + // echo '

OverNight:'.$overnight.'

'; + $handling_processing_fee = number_format((float)((float)$handling_fee + (float)$overnight),2); + unset( $dat ); + $dat['name'] = 'Handling & Processing Fees'; + $dat['adult_total'] = ''; + $dat['adult_price_total'] = ''; + $dat['youth_total'] = ''; + $dat['youth_price_total'] = ''; + $dat['child_total'] = ''; + $dat['child_price_total'] = ''; + $dat['total'] = ''; + $dat['total_price'] = '$'.$handling_processing_fee; + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); + // Grand total line + unset( $dat ); + $dat['name'] = 'Grand Total'; + $dat['adult_total'] = ''; + $dat['adult_price_total'] = ''; + $dat['youth_total'] = ''; + $dat['youth_price_total'] = ''; + $dat['child_total'] = ''; + $dat['child_price_total'] = ''; + $dat['total'] = ''; + $total_price = (float)((float)((float)$handling_fee + (float)$overnight) + (float)$total_price); + $dat['total_price'] = '$'.number_format($total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); - $summary_report['total_packages_sold'] = $total_packages; - $summary_report['summary_type'] = 'Confirmed & Processed Packages'; - $summary_report['adult'] = $adult; - $summary_report['youth'] = $youth; - $summary_report['child'] = $child; - $summary_report['ticket_member_total_table'] = $package_member_summary_table; - $summary_table .= $this->explode_template( SUMMARY_REPORT,$summary_report ); - $out = $this->summary_search_form(); - $out .= $summary_table; - return( $out ); - } - function view_member_report() - { - // need to know if this is a ferry line or other - $member_id = $_SESSION['auth']['userid']; - if( $_SESSION['auth']['ferry'] == 't' ) - { - $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total = $total_price = 0; - $member_data = $this->get_ferry_summary( $member_id ); - unset( $t_dat ); - $adult += (int)$member_data[$member_id]['adult']; - $adult_price += (float)$member_data[$member_id]['adult_price']; - $youth += (int)$member_data[$member_id]['youth']; - $youth_price += (float)$member_data[$member_id]['youth_price']; - $child += (int)$member_data[$member_id]['child']; - $child_price += (float)$member_data[$member_id]['child_price']; - $total += (int)$member_data[$member_id]['total_packages_sold']; - $t_dat['name'] = $ticket_row; - $t_dat['adult_total'] = $member_data[$member_id]['adult']; - $t_dat['adult_price_total'] = '$'.number_format($member_data[$member_id]['adult_price'],2); - $t_dat['youth_total'] = $member_data[$member_id]['youth']; - $t_dat['youth_price_total'] = '$'.number_format($member_data[$member_id]['youth_price'],2); - $t_dat['child_total'] = $member_data[$member_id]['child']; - $t_dat['child_price_total'] = '$'.number_format($member_data[$member_id]['child_price'],2); - $t_dat['total'] = $member_data[$member_id]['adult_price']; - $member_total_price = (float)$member_data[$member_id]['adult_price']; - $member_total_price += (float)$member_data[$member_id]['youth_price']; - $member_total_price += (float)$member_data[$member_id]['child_price']; - $total_price += $member_total_price; - $t_dat['total_price'] = '$'.number_format($member_total_price,2); - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - $handling_fee += (float)$member_data[$member_id]['handling_fee']; - $overnight += (float)$member_data[$member_id]['overnight']; - $total_packages = $member_data[$member_id]['total_packages_sold']; - } - else - { - $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total_price = $total = 0; - $member_data = $this->get_member_summary( $member_id ); - unset( $t_dat ); - $adult = (int)$member_data[$member_id]['adult']; - $adult_price += (float)$member_data[$member_id]['adult_price']; - $youth = (int)$member_data[$member_id]['youth']; - $youth_price += (float)$member_data[$member_id]['youth_price']; - $child = (int)$member_data[$member_id]['child']; - $child_price += (float)$member_data[$member_id]['child_price']; - $total = (int)$member_data[$member_id]['total_packages_sold']; - $t_dat['name'] = $ticket_row; - $t_dat['adult_total'] = $member_data[$member_id]['adult']; - $t_dat['adult_price_total'] = '$'.number_format($member_data[$member_id]['adult_price'],2); - $t_dat['youth_total'] = $member_data[$member_id]['youth']; - $t_dat['youth_price_total'] = '$'.number_format($member_data[$member_id]['youth_price'],2); - $t_dat['child_total'] = $member_data[$member_id]['child']; - $t_dat['child_price_total'] = '$'.number_format($member_data[$member_id]['child_price'],2); - $t_dat['total'] = $member_data[$member_id]['adult_price']; - $member_total_price = (float)$member_data[$member_id]['adult_price']; - $member_total_price += (float)$member_data[$member_id]['youth_price']; - $member_total_price += (float)$member_data[$member_id]['child_price']; - $t_dat['total_price'] = '$'.number_format($member_total_price,2); - $total_price += $member_total_price; - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); - $handling_fee += (float)$member_data[$member_id]['handling_fee']; - $overnight += (float)$member_data[$member_id]['overnight']; - $total_packages = $member_data[$member_id]['total_packages_sold']; + $summary_report['total_packages_sold'] = $total_packages; + $summary_report['summary_type'] = 'Confirmed & Processed Packages'; + $summary_report['adult'] = $adult; + $summary_report['youth'] = $youth; + $summary_report['child'] = $child; + $summary_report['ticket_member_total_table'] = $package_member_summary_table; + $summary_table .= $this->explode_template( SUMMARY_REPORT,$summary_report ); + $out = $this->summary_search_form(); + $out .= $summary_table; + return( $out ); + } - } + function view_member_report() + { + // need to know if this is a ferry line or other + $member_id = $_SESSION['auth']['userid']; + if( $_SESSION['auth']['ferry'] == 't' ) + { + $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total = $total_price = 0; + $member_data = $this->get_ferry_summary( $member_id ); + unset( $t_dat ); + $adult += (int)$member_data[$member_id]['adult']; + $adult_price += (float)$member_data[$member_id]['adult_price']; + $youth += (int)$member_data[$member_id]['youth']; + $youth_price += (float)$member_data[$member_id]['youth_price']; + $child += (int)$member_data[$member_id]['child']; + $child_price += (float)$member_data[$member_id]['child_price']; + $total += (int)$member_data[$member_id]['total_packages_sold']; + $t_dat['name'] = $ticket_row; + $t_dat['adult_total'] = $member_data[$member_id]['adult']; + $t_dat['adult_price_total'] = '$'.number_format($member_data[$member_id]['adult_price'],2); + $t_dat['youth_total'] = $member_data[$member_id]['youth']; + $t_dat['youth_price_total'] = '$'.number_format($member_data[$member_id]['youth_price'],2); + $t_dat['child_total'] = $member_data[$member_id]['child']; + $t_dat['child_price_total'] = '$'.number_format($member_data[$member_id]['child_price'],2); + $t_dat['total'] = $member_data[$member_id]['adult_price']; + $member_total_price = (float)$member_data[$member_id]['adult_price']; + $member_total_price += (float)$member_data[$member_id]['youth_price']; + $member_total_price += (float)$member_data[$member_id]['child_price']; + $total_price += $member_total_price; + $t_dat['total_price'] = '$'.number_format($member_total_price,2); + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); + $handling_fee += (float)$member_data[$member_id]['handling_fee']; + $overnight += (float)$member_data[$member_id]['overnight']; + $total_packages = $member_data[$member_id]['total_packages_sold']; + } + else + { + $adult = $adult_price = $youth = $youth_price = $child = $child_price = $total_price = $total = 0; + $member_data = $this->get_member_summary( $member_id ); + unset( $t_dat ); + $adult = (int)$member_data[$member_id]['adult']; + $adult_price += (float)$member_data[$member_id]['adult_price']; + $youth = (int)$member_data[$member_id]['youth']; + $youth_price += (float)$member_data[$member_id]['youth_price']; + $child = (int)$member_data[$member_id]['child']; + $child_price += (float)$member_data[$member_id]['child_price']; + $total = (int)$member_data[$member_id]['total_packages_sold']; + $t_dat['name'] = $ticket_row; + $t_dat['adult_total'] = $member_data[$member_id]['adult']; + $t_dat['adult_price_total'] = '$'.number_format($member_data[$member_id]['adult_price'],2); + $t_dat['youth_total'] = $member_data[$member_id]['youth']; + $t_dat['youth_price_total'] = '$'.number_format($member_data[$member_id]['youth_price'],2); + $t_dat['child_total'] = $member_data[$member_id]['child']; + $t_dat['child_price_total'] = '$'.number_format($member_data[$member_id]['child_price'],2); + $t_dat['total'] = $member_data[$member_id]['adult_price']; + $member_total_price = (float)$member_data[$member_id]['adult_price']; + $member_total_price += (float)$member_data[$member_id]['youth_price']; + $member_total_price += (float)$member_data[$member_id]['child_price']; + $t_dat['total_price'] = '$'.number_format($member_total_price,2); + $total_price += $member_total_price; + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$t_dat ); + $handling_fee += (float)$member_data[$member_id]['handling_fee']; + $overnight += (float)$member_data[$member_id]['overnight']; + $total_packages = $member_data[$member_id]['total_packages_sold']; - // handling and processing total line - $handling_processing_fee = number_format((float)((float)$handling_fee + (float)$overnight),2); - unset( $dat ); - $dat['name'] = 'Handling & Processing Fees'; - $dat['adult_total'] = ''; - $dat['adult_price_total'] = ''; - $dat['youth_total'] = ''; - $dat['youth_price_total'] = ''; - $dat['child_total'] = ''; - $dat['child_price_total'] = ''; - $dat['total'] = ''; - $dat['total_price'] = '$'.$handling_processing_fee; - $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); + } - $summary_report['total_packages_sold'] = $total_packages; - $summary_report['adult'] = $adult; - $summary_report['youth'] = $youth; - $summary_report['child'] = $child; - $summary_report['ticket_member_total_table'] = $package_member_summary_table; - $summary_table .= $this->explode_template( SUMMARY_REPORT,$summary_report ); - $out = $this->summary_search_form(); - $out .= $summary_table; - return( $out ); - } + // handling and processing total line + $handling_processing_fee = number_format((float)((float)$handling_fee + (float)$overnight),2); + unset( $dat ); + $dat['name'] = 'Handling & Processing Fees'; + $dat['adult_total'] = ''; + $dat['adult_price_total'] = ''; + $dat['youth_total'] = ''; + $dat['youth_price_total'] = ''; + $dat['child_total'] = ''; + $dat['child_price_total'] = ''; + $dat['total'] = ''; + $dat['total_price'] = '$'.$handling_processing_fee; + $package_member_summary_table .= $this->explode_template( SUMMARY_REPORT_MEMBER,$dat ); - function get_member_summary( $member_id = null ) - { - $adult = $youth = $child = $handling_fee = $overnight = 0; - $where = ''; - if( $_GET['start_date'] ) - { - $where .= "and ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; - } - if( $_GET['end_date'] ) - { - $where .= "and ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; - } - $query = "select - count(id) as total, - sum(adult) as adult, - sum(youth) as youth, - sum(child) as child, - sum(handling_fee) as handling_fee, - sum(overnight) as overnight - from package_req where status = 2 $where"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - $adult = $data[0]['adult']; - $youth = $data[0]['youth']; - $child = $data[0]['child']; - $handling_fee = (float)$data[0]['handling_fee']; - $overnight = (float)$data[0]['overnight']; - } - if( $member_id ) - { - $array = array($member_id=>$this->ticket_members[$member_id]); - } - else - { - $array = $this->ticket_members; - } - $total_packages = ( $data[0]['total'] ) ? $data[0]['total'] : 0; - foreach( $array as $member_id => $member_name ) - { - $total_price = $this->package_prices[$member_name]['adult'] * $adult; - $total_price += $this->package_prices[$member_name]['youth'] * $youth; - $total_price += $this->package_prices[$member_name]['child'] * $child; - $out_array[$member_id] = array( - 'adult'=>$adult, - 'adult_price'=> $this->package_prices[$member_name]['adult'] * $adult, - 'youth'=>$youth, - 'youth_price'=>$this->package_prices[$member_name]['youth'] * $youth, - 'child'=>$child, - 'child_price'=>$this->package_prices[$member_name]['child'] * $child, - 'handling_fee'=>$handling_fee, - 'overnight'=>$overnight, - 'total_packages_sold'=>$total_packages, - 'total_sold'=>$total_price - ); - } - return( $out_array ); - } + $summary_report['total_packages_sold'] = $total_packages; + $summary_report['adult'] = $adult; + $summary_report['youth'] = $youth; + $summary_report['child'] = $child; + $summary_report['ticket_member_total_table'] = $package_member_summary_table; + $summary_table .= $this->explode_template( SUMMARY_REPORT,$summary_report ); + $out = $this->summary_search_form(); + $out .= $summary_table; + return( $out ); + } + function get_member_summary( $member_id = null ) + { + $adult = $youth = $child = $handling_fee = $overnight = 0; + $where = ''; + if( $_GET['start_date'] ) + { + $where .= "and ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; + } + if( $_GET['end_date'] ) + { + $where .= "and ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; + } + $query = "select + count(id) as total, + sum(adult) as adult, + sum(youth) as youth, + sum(child) as child, + sum(handling_fee) as handling_fee, + sum(overnight) as overnight + from package_req where status = 2 $where"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + $adult = $data[0]['adult']; + $youth = $data[0]['youth']; + $child = $data[0]['child']; + $handling_fee = (float)$data[0]['handling_fee']; + $overnight = (float)$data[0]['overnight']; + } + if( $member_id ) + { + $array = array($member_id=>$this->ticket_members[$member_id]); + } + else + { + $array = $this->ticket_members; + } + $total_packages = ( $data[0]['total'] ) ? $data[0]['total'] : 0; + foreach( $array as $member_id => $member_name ) + { + $total_price = $this->package_prices[$member_name]['adult'] * $adult; + $total_price += $this->package_prices[$member_name]['youth'] * $youth; + $total_price += $this->package_prices[$member_name]['child'] * $child; + $out_array[$member_id] = array( + 'adult'=>$adult, + 'adult_price'=> $this->package_prices[$member_name]['adult'] * $adult, + 'youth'=>$youth, + 'youth_price'=>$this->package_prices[$member_name]['youth'] * $youth, + 'child'=>$child, + 'child_price'=>$this->package_prices[$member_name]['child'] * $child, + 'handling_fee'=>$handling_fee, + 'overnight'=>$overnight, + 'total_packages_sold'=>$total_packages, + 'total_sold'=>$total_price + ); + } + return( $out_array ); + } - function get_ferry_summary( $member_id = null ) - { - $adult = $youth = $child = $handling_fee = $overnight = 0; - if( $_GET['start_date'] ) - { - $where .= "and ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; - } - if( $_GET['end_date'] ) - { - $where .= "and ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; - } - $query = "select - count(id) as total, - sum(adult) as adult, - sum(youth) as youth, - sum(child) as child, - sum(handling_fee) as handling_fee, - sum(overnight) as overnight - from package_req where status = 2 $where"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - $adult = $data[0]['adult']; - $youth = $data[0]['youth']; - $child = $data[0]['child']; - $handling_fee = (float)$data[0]['handling_fee']; - $overnight = (float)$data[0]['overnight']; - } - if( $member_id ) - { - $array = array($member_id=>$this->ferry_members[$member_id]); - } - else - { - $array = $this->ferry_members; - } - foreach( $array as $member_id => $member_name ) - { - $total_price = $this->package_prices[$member_name]['adult'] * $adult; - $total_price += $this->package_prices[$member_name]['youth'] * $youth; - $total_price += $this->package_prices[$member_name]['child'] * $child; - $out_array[$member_id] = array( - 'adult'=>$adult, - 'adult_price'=> $this->package_prices[$member_name]['adult'] * $adult, - 'youth'=>$youth, - 'youth_price'=>$this->package_prices[$member_name]['youth'] * $youth, - 'child'=>$child, - 'child_price'=>$this->package_prices[$member_name]['child'] * $child, - 'handling_fee'=>$handling_fee, - 'overnight'=>$overnight, - 'total_packages_sold'=>$data[0]['total'], - 'total_sold'=>$total_price - ); - } - return( $out_array ); - } - function get_confirmed_list() - { - $status = 2; - $out = $this->get_package_list( $status ); - return( $out ); - } - function get_pending_list() - { - $status = 1; - $out = $this->get_package_list( $status ); - return( $out ); - } - function get_deleted_list() - { - $status = 3; - $out = $this->get_package_list( $status ); - return( $out ); - } - function settlement_report() - { - $sdate = ''; - $edate = ''; - $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; - $out .= '
- -
+ function get_ferry_summary( $member_id = null ) + { + $adult = $youth = $child = $handling_fee = $overnight = 0; + if( $_GET['start_date'] ) + { + $where .= "and ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; + } + if( $_GET['end_date'] ) + { + $where .= "and ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; + } + $query = "select + count(id) as total, + sum(adult) as adult, + sum(youth) as youth, + sum(child) as child, + sum(handling_fee) as handling_fee, + sum(overnight) as overnight + from package_req where status = 2 $where"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + $adult = $data[0]['adult']; + $youth = $data[0]['youth']; + $child = $data[0]['child']; + $handling_fee = (float)$data[0]['handling_fee']; + $overnight = (float)$data[0]['overnight']; + } + if( $member_id ) + { + $array = array($member_id=>$this->ferry_members[$member_id]); + } + else + { + $array = $this->ferry_members; + } + foreach( $array as $member_id => $member_name ) + { + $total_price = $this->package_prices[$member_name]['adult'] * $adult; + $total_price += $this->package_prices[$member_name]['youth'] * $youth; + $total_price += $this->package_prices[$member_name]['child'] * $child; + $out_array[$member_id] = array( + 'adult'=>$adult, + 'adult_price'=> $this->package_prices[$member_name]['adult'] * $adult, + 'youth'=>$youth, + 'youth_price'=>$this->package_prices[$member_name]['youth'] * $youth, + 'child'=>$child, + 'child_price'=>$this->package_prices[$member_name]['child'] * $child, + 'handling_fee'=>$handling_fee, + 'overnight'=>$overnight, + 'total_packages_sold'=>$data[0]['total'], + 'total_sold'=>$total_price + ); + } + return( $out_array ); + } + + function get_confirmed_list() + { + $status = 2; + $out = $this->get_package_list( $status ); + return( $out ); + } + function get_pending_list() + { + $status = 1; + $out = $this->get_package_list( $status ); + return( $out ); + } + function get_deleted_list() + { + $status = 3; + $out = $this->get_package_list( $status ); + return( $out ); + } + function settlement_report() + { + $sdate = ''; + $edate = ''; + $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; + $out .= '
+ +
- - '; - if( $_GET['start_date'] ) - { - $where_part[] = " ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; - } - if( $_GET['end_date'] ) - { - $where_part[] = " ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; - } - if( is_array( $where_part ) ) - { - $where = " AND ".implode("AND",$where_part); - } - else - { - $where = ''; - } - if( $_GET['start_date'] && $_GET['end_date'] ) - { - $query1 = "select * from settlement where date_part('year',start_date) = ".date('Y'); - if( $data1 = $this->DB->db_auto_get_data( $query1 ) ) - { - foreach( $data1 as $drow ) - { - $total_paid_out_ar[$drow['ticket_member_id']] += (float)$drow['amount']; - } - } - $query1 = "select * from settlement where start_date >= '".$_GET['start_date']."' and end_date <= '".$_GET['end_date']."'"; - if( $data1 = $this->DB->db_auto_get_data( $query1 ) ) - { - foreach( $data1 as $drow ) - { - $total_paid_ar[$drow['ticket_member_id']] += (float)$drow['amount']; - } - } - $query = "select sum(adult) as adult,sum(youth) as youth,sum(child) as child from package_req where status = 2 $where;"; - if( $data = $this->DB->db_auto_get_data( $query )) - { - $adult = $data[0]['adult']; - $youth = $data[0]['youth']; - $child = $data[0]['child']; - } - $query = "set datestyle to 'sql,us';select id,settlement_date,ferry,name,adult,youth,child,total_paid from ticket_member order by id;"; - if( $data2 = $this->DB->db_auto_get_data( $query ) ) - { - $out .= ' -
-
- - - - -
- Settlement Form - '; - $out .= ''; - $out .= ' - - - - - - '; - foreach( $data2 as $row ) - { - $ptotal_paid = ( $total_paid_out_ar[$row['id']] ) ? $total_paid_out_ar[$row['id']] : '0'; - $ptotal = ( $total_paid_ar[$row['id']] ) ? $total_paid_ar[$row['id']] : '0'; - if( $row['ferry'] == 't' ) - { - $query = "select sum(adult) as adult,sum(youth) as youth,sum(child) as child from package_req where ferry_id = ".$row['id']." and status = 2 $where;"; - if( $data2 = $this->DB->db_auto_get_data( $query ) ) - { - $total_adult = (float)((float)$row['adult'] * (float)$data2[0]['adult']); - $total_youth = (float)((float)$row['youth'] * (float)$data2[0]['youth']); - $total_child = (float)((float)$row['child'] * (float)$data2[0]['child']); - } - else - { - $total_adult = (float)0.00; - $total_youth = (float)0.00; - $total_child = (float)0.00; - } - } - else - { - $total_adult = (float)((float)$adult * (float)$row['adult']); - $total_youth = (float)((float)$youth * (float)$row['youth']); - $total_child = (float)((float)$child * (float)$row['child']); - } - $total_receipts = (float)((float)$total_adult + (float)$total_youth + (float)$total_child); - (float)$due = (float)((float)$total_receipts - (float)$ptotal); - $out .= ' - - - - - - '; - } - $out .= ' - - '; - $out .= '
MemberPaid/TotalPaid/PeriodDueSettlement
'.$row["name"].'$'.number_format($ptotal_paid,2).'$'.number_format($ptotal,2).'$'.number_format($due,2).'
'; - $out .= ' - -
-
-
'; - } - } - return( $out ); - } - function update_settlement() - { - // echo '
';
-	//	print_r( $_POST );
-	//	echo '
'; - $this->DB->db_exec( "BEGIN WORK;" ); - if( is_array( $_POST['ticket_member'] ) ) - { - foreach( $_POST['ticket_member'] as $id => $value ) - { - $value = (float)$value; - if( is_numeric( $value ) && $value != '0' ) - { - // $query = "select id from settlement where ticket_member_id = $id and start_date = '".$_POST['start_date']."' and end_date = '".$_POST['end_date']."' and type = '".$_POST['summary_type']."'"; - // $data1 = $this->DB->db_exec( $query ); - // if( pg_numrows( $data1 ) > 0 ) - // { - // $set_id = pg_result( $data1, 0, 'id' ); - // if updating then - // $query = "update ticket_member set settlement_date = current_date, total_paid = total_paid + '".(float)$value."' where id = ".$set_id; + '; + if( $_GET['start_date'] ) + { + $where_part[] = " ".$_GET['summary_type']." >= '".$_GET['start_date']."'"; + } + if( $_GET['end_date'] ) + { + $where_part[] = " ".$_GET['summary_type']." <= '".$_GET['end_date']."'"; + } + if( is_array( $where_part ) ) + { + $where = " AND ".implode("AND",$where_part); + } + else + { + $where = ''; + } + if( $_GET['start_date'] && $_GET['end_date'] ) + { + $query1 = "select * from settlement where date_part('year',start_date) = ".date('Y'); + if( $data1 = $this->DB->db_auto_get_data( $query1 ) ) + { + foreach( $data1 as $drow ) + { + $total_paid_out_ar[$drow['ticket_member_id']] += (float)$drow['amount']; + } + } + $query1 = "select * from settlement where start_date >= '".$_GET['start_date']."' and end_date <= '".$_GET['end_date']."'"; + if( $data1 = $this->DB->db_auto_get_data( $query1 ) ) + { + foreach( $data1 as $drow ) + { + $total_paid_ar[$drow['ticket_member_id']] += (float)$drow['amount']; + } + } + $query = "select sum(adult) as adult,sum(youth) as youth,sum(child) as child from package_req where status = 2 $where;"; + if( $data = $this->DB->db_auto_get_data( $query )) + { + $adult = $data[0]['adult']; + $youth = $data[0]['youth']; + $child = $data[0]['child']; + } + $query = "set datestyle to 'sql,us';select id,settlement_date,ferry,name,adult,youth,child,total_paid from ticket_member order by id;"; + if( $data2 = $this->DB->db_auto_get_data( $query ) ) + { + $out .= ' +
+
+ + + + +
+ Settlement Form + '; + $out .= ''; + $out .= ' + + + + + + '; + foreach( $data2 as $row ) + { + $ptotal_paid = ( $total_paid_out_ar[$row['id']] ) ? $total_paid_out_ar[$row['id']] : '0'; + $ptotal = ( $total_paid_ar[$row['id']] ) ? $total_paid_ar[$row['id']] : '0'; + if( $row['ferry'] == 't' ) + { + $query = "select sum(adult) as adult,sum(youth) as youth,sum(child) as child from package_req where ferry_id = ".$row['id']." and status = 2 $where;"; + if( $data2 = $this->DB->db_auto_get_data( $query ) ) + { + $total_adult = (float)((float)$row['adult'] * (float)$data2[0]['adult']); + $total_youth = (float)((float)$row['youth'] * (float)$data2[0]['youth']); + $total_child = (float)((float)$row['child'] * (float)$data2[0]['child']); + } + else + { + $total_adult = (float)0.00; + $total_youth = (float)0.00; + $total_child = (float)0.00; + } + } + else + { + $total_adult = (float)((float)$adult * (float)$row['adult']); + $total_youth = (float)((float)$youth * (float)$row['youth']); + $total_child = (float)((float)$child * (float)$row['child']); + } + $total_receipts = (float)((float)$total_adult + (float)$total_youth + (float)$total_child); + (float)$due = (float)((float)$total_receipts - (float)$ptotal); + $out .= ' + + + + + + '; + } + $out .= ' + + '; + $out .= '
MemberPaid/TotalPaid/PeriodDueSettlement
'.$row["name"].'$'.number_format($ptotal_paid,2).'$'.number_format($ptotal,2).'$'.number_format($due,2).'
'; + $out .= ' - // } - // else - // { - $query = "insert into settlement (ticket_member_id,start_date,end_date,amount) values ($id,'".$_POST['start_date']."','".$_POST['end_date']."','$value');"; - // } - // echo '

'.$query.'

'; - if( !$this->DB->db_exec( $query ) ) - { - return( false ); - } - } - } - } - // exit(); - $this->DB->db_exec( "COMMIT WORK;" ); - $_GET['start_date'] = $_POST['start_date']; - $_GET['end_date'] = $_POST['end_date']; - $_GET['summary_type'] = $_POST['summary_type']; - return( false ); - } - function summary_search_form() - { +
+
+
'; + } + } + return( $out ); + } + function update_settlement() + { + // echo '
';
+    //  print_r( $_POST );
+    //  echo '
'; + $this->DB->db_exec( "BEGIN WORK;" ); + if( is_array( $_POST['ticket_member'] ) ) + { + foreach( $_POST['ticket_member'] as $id => $value ) + { + $value = (float)$value; + if( is_numeric( $value ) && $value != '0' ) + { + // $query = "select id from settlement where ticket_member_id = $id and start_date = '".$_POST['start_date']."' and end_date = '".$_POST['end_date']."' and type = '".$_POST['summary_type']."'"; + // $data1 = $this->DB->db_exec( $query ); + // if( pg_numrows( $data1 ) > 0 ) + // { + // $set_id = pg_result( $data1, 0, 'id' ); + // if updating then + // $query = "update ticket_member set settlement_date = current_date, total_paid = total_paid + '".(float)$value."' where id = ".$set_id; - $sdate = ''; - $edate = ''; - $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; - $out .= '
- -
-
+ // } + // else + // { + $query = "insert into settlement (ticket_member_id,start_date,end_date,amount) values ($id,'".$_POST['start_date']."','".$_POST['end_date']."','$value');"; + // } + // echo '

'.$query.'

'; + if( !$this->DB->db_exec( $query ) ) + { + return( false ); + } + } + } + } + // exit(); + $this->DB->db_exec( "COMMIT WORK;" ); + $_GET['start_date'] = $_POST['start_date']; + $_GET['end_date'] = $_POST['end_date']; + $_GET['summary_type'] = $_POST['summary_type']; + return( false ); + } + function summary_search_form() + { + + $sdate = ''; + $edate = ''; + $Action = ( $_GET['Action'] ) ? $_GET['Action'] : $_POST['Action']; + $out .= '
+ +
+
- - '; - return( $out ); - } - function package_search_form() - { + '; + return( $out ); + } + function package_search_form() + { - $sdate = ''; - $edate = ''; - $Action = $_REQUEST['Action']; - $out .= '
- -
+ $sdate = ''; + $edate = ''; + $Action = $_REQUEST['Action']; + $out .= '
+ +
- - '; - return $out; - } - function get_package_list($status) - { - $headers = array('id'=>'Function','id2'=>'Delete'); - foreach ($this->administrator->fields as $field_name => $fields) { - if (strstr($fields['view'], 'l')) { - $sel[] = $field_name; - } - } - $where = ''; - if ($_REQUEST['last_name']) { - $where .= "and bill_lname ilike '".$_REQUEST['last_name']."'"; - } - if ($_REQUEST['package_number'] && is_numeric($_REQUEST['package_number'])) { - $where .= 'and package_number = '.$_REQUEST['package_number']; - } - if ($_REQUEST['start_date']) { - $where .= "and package_date >= '".$_REQUEST['start_date']."'"; - } - if ($_REQUEST['end_date']) { - $where .= "and package_date <= '".$_REQUEST['end_date']."'"; - } - $query = "set datestyle to 'sql,us'; - select ".implode(",",$sel)." - from package_req - where status = ".$status." - $where - order by package_date,bill_lname,bill_fname;"; - //echo $query; - if ($data = $this->DB->db_auto_get_data($query)) { - foreach ($data as $key => $row) { - $data[$key]['id'] = ''.EDIT_PACKAGE_ICON.' '; - if ($status != 3) { - $data[$key]['id'] .= ''.PRINT_PACKAGE_ICON.' '; - } - if ($status != 3) { - $data[$key]['id2'] .= ''.DELETE_PACKAGE_ICON.' '; - } - } - $out = $this->package_search_form(); - $out .= $this->administrator->list_results($data, $headers); - } else { - $out = $this->package_search_form(); - $out .= '

No results

'; - } - return $out; - } + '; + return $out; + } + function get_package_list($status) + { + $headers = array('id'=>'Function','id2'=>'Delete'); + foreach ($this->administrator->fields as $field_name => $fields) { + if (strstr($fields['view'], 'l')) { + $sel[] = $field_name; + } + } + $where = ''; + if ($_REQUEST['last_name']) { + $where .= "and bill_lname ilike '".$_REQUEST['last_name']."'"; + } + if ($_REQUEST['package_number'] && is_numeric($_REQUEST['package_number'])) { + $where .= 'and package_number = '.$_REQUEST['package_number']; + } + if ($_REQUEST['start_date']) { + $where .= "and package_date >= '".$_REQUEST['start_date']."'"; + } + if ($_REQUEST['end_date']) { + $where .= "and package_date <= '".$_REQUEST['end_date']."'"; + } + $query = "set datestyle to 'sql,us'; + select ".implode(",",$sel)." + from package_req + where status = ".$status." + $where + order by package_date,bill_lname,bill_fname;"; + //echo $query; + if ($data = $this->DB->db_auto_get_data($query)) { + foreach ($data as $key => $row) { + $data[$key]['id'] = ''.EDIT_PACKAGE_ICON.' '; + if ($status != 3) { + $data[$key]['id'] .= ''.PRINT_PACKAGE_ICON.' '; + } + if ($status != 3) { + $data[$key]['id2'] .= ''.DELETE_PACKAGE_ICON.' '; + } + } + $out = $this->package_search_form(); + $out .= $this->administrator->list_results($data, $headers); + } else { + $out = $this->package_search_form(); + $out .= '

No results

'; + } + return $out; + } - function delete_package( $id ) - { - // for packages don't delete them just move them into a delete table - // echo '
';
-	//	print_r( $this->administrator );
-	//	echo '
'; - $form =& $this->administrator; - $query = "update ".$form->table." set status = '3' where ".$form->primary_key." = $id"; - $this->DB->db_auto_exec( $query ); - } - - function edit_package( $id = null ) - { - $query = "set datestyle to 'sql,us';select * from package_req where id = $id"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - $out .= $this->administrator->edit_result( $data[0] ); - $out .= ' - - - - '; - } - else - { - return( false ); - } - $out .= ' - '; - $out .= $this->administrator->form_scripts; - return( $out ); - } + function delete_package( $id ) + { + // for packages don't delete them just move them into a delete table + // echo '
';
+    //  print_r( $this->administrator );
+    //  echo '
'; + $form =& $this->administrator; + $query = "update ".$form->table." set status = '3' where ".$form->primary_key." = $id"; + $this->DB->db_auto_exec( $query ); + } - function update_package( $id ) - { - if( !$this->administrator->update_result() ) - { - return( $this->edit_package( $id ) ); - } - else - { - return( 'Your Record is updated' ); - } - } + function edit_package( $id = null ) + { + $query = "set datestyle to 'sql,us';select * from package_req where id = $id"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + $out .= $this->administrator->edit_result( $data[0] ); + $out .= ' + + + + '; + } + else + { + return( false ); + } + $out .= ' + '; + $out .= $this->administrator->form_scripts; + return( $out ); + } - function get_package_prices() - { - $query = "select name,adult,youth,child from ticket_member"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - foreach( $data as $row ) - { - $out_array[$row['name']]['adult'] = $row['adult']; - $out_array[$row['name']]['youth'] = $row['youth']; - $out_array[$row['name']]['child'] = $row['child']; - } - return( $out_array ); - } - } + function update_package( $id ) + { + if( !$this->administrator->update_result() ) + { + return( $this->edit_package( $id ) ); + } + else + { + return( 'Your Record is updated' ); + } + } - function get_ticket_members() - { - $query = "select id,name from ticket_member where ferry != 't' order by id"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - foreach( $data as $row ) - { - $out_array[$row['id']] = $row['name']; - } - return( $out_array ); - } - } + function get_package_prices() + { + $query = "select name,adult,youth,child from ticket_member"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + foreach( $data as $row ) + { + $out_array[$row['name']]['adult'] = $row['adult']; + $out_array[$row['name']]['youth'] = $row['youth']; + $out_array[$row['name']]['child'] = $row['child']; + } + return( $out_array ); + } + } - function get_ferry_members() - { - $query = "select id,name from ticket_member where ferry = 't' order by id"; - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - foreach( $data as $row ) - { - $out_array[$row['id']] = $row['name']; - } - return( $out_array ); - } - } + function get_ticket_members() + { + $query = "select id,name from ticket_member where ferry != 't' order by id"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + foreach( $data as $row ) + { + $out_array[$row['id']] = $row['name']; + } + return( $out_array ); + } + } - function view_package( $id ) - { - // echo '
';
-	//	print_r( $this->administrator->fields );
-	//	echo '
'; - foreach( $this->administrator->fields as $field_name => $fields ) - { - if( strstr( $fields['view'], 'v' ) ) - { - $sel[] = $fields['name']; - } - } - $query = "select ".implode(",",$sel)." from ".$this->administrator->table." where ".$this->administrator->primary_key." = $id"; - // echo $query; + function get_ferry_members() + { + $query = "select id,name from ticket_member where ferry = 't' order by id"; + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + foreach( $data as $row ) + { + $out_array[$row['id']] = $row['name']; + } + return( $out_array ); + } + } - if( $data = $this->DB->db_auto_get_data( $query ) ) - { - $out = $this->explode_template( PACKAGE_VIEW, $data[0] ); - if( is_array( $this->package_prices ) && is_array( $this->ticket_members ) ) - { - foreach( $this->ticket_members as $memb_row ) - { - unset( $memb_data ); - $memb_data['value'] = ''; - $out = $this->explode_template( PACKAGE_VIEW_MEMBER, $row ); - } - } - // echo '
';
-		//	print_r( $data );
-		//	echo '
'; - } - return( $out ); - } + function view_package( $id ) + { + // echo '
';
+    //  print_r( $this->administrator->fields );
+    //  echo '
'; + foreach( $this->administrator->fields as $field_name => $fields ) + { + if( strstr( $fields['view'], 'v' ) ) + { + $sel[] = $fields['name']; + } + } + $query = "select ".implode(",",$sel)." from ".$this->administrator->table." where ".$this->administrator->primary_key." = $id"; + // echo $query; + + if( $data = $this->DB->db_auto_get_data( $query ) ) + { + $out = $this->explode_template( PACKAGE_VIEW, $data[0] ); + if( is_array( $this->package_prices ) && is_array( $this->ticket_members ) ) + { + foreach( $this->ticket_members as $memb_row ) + { + unset( $memb_data ); + $memb_data['value'] = ''; + $out = $this->explode_template( PACKAGE_VIEW_MEMBER, $row ); + } + } + // echo '
';
+        //  print_r( $data );
+        //  echo '
'; + } + return( $out ); + } } ?> diff --git a/classes/class_template.inc b/classes/class_template.inc index 3b84d4e..bb0d763 100755 --- a/classes/class_template.inc +++ b/classes/class_template.inc @@ -154,7 +154,7 @@ class GLM_TEMPLATE{ function GLM_TEMPLATE( $catid, $DB = NULL ) { $this->catid = $this->get_catid( $catid ); // sets $this->catid - $this->set_DB( &$DB ); // using a reference to $DB (should be started on setup.phtml + $this->set_DB( $DB ); // using a reference to $DB (should be started on setup.phtml //$this->Member = $this->set_member(); // used for cvb's $this->header_begin = "

"; // class="content" should not be used anymore $this->header_end = "

"; // create style for p h1 h2 tags if needed try to keep it clean @@ -166,7 +166,7 @@ class GLM_TEMPLATE{ $this->whole_thread = ""; // do not touch this it is used for menu generation $this->thread_count = 1; // also used for menu generation $this->php_ext = '.php'; // defaults to .php - $this->set_pages( &$GLOBALS['PAGES'] ); // Uses the PAGE array set in setup.phtml + $this->set_pages( $GLOBALS['PAGES'] ); // Uses the PAGE array set in setup.phtml $this->page_status( $catid ); // tell if page is active, deleted or inactive $this->set_active_query(); // set active query string } @@ -243,7 +243,7 @@ class GLM_TEMPLATE{ if( MEMBERS_DB && $this->catid ) { require_once(BASE.'classes/class_members.inc'); - $Member = new glm_members( &$this ); + $Member = new glm_members( $this ); return( $Member ); } } @@ -1362,7 +1362,7 @@ class GLM_TEMPLATE{ * @return bool * @access public **/ - function is_sub_id($catid,$category,&$DB) + function is_sub_id($catid,$category,$DB) { if( !is_numeric( $catid ) ) { @@ -1381,7 +1381,7 @@ class GLM_TEMPLATE{ } else { - return( GLM_TEMPLATE::is_sub_id($parent,$category,&$DB) ); + return( GLM_TEMPLATE::is_sub_id($parent,$category,$DB) ); } } @@ -1395,7 +1395,7 @@ class GLM_TEMPLATE{ * @return int $parent * @access public **/ - function get_parent($catid,&$DB) + function get_parent($catid,$DB) { $query = "SELECT parent FROM bus_category WHERE id = $catid ORDER BY pos"; $data = $DB->db_auto_get_data($query); @@ -1417,9 +1417,9 @@ class GLM_TEMPLATE{ * @return string * @access public **/ - function get_sub_nav($catid,&$DB) + function get_sub_nav($catid,$DB) { - $parentid = GLM_TEMPLATE::get_parent($catid,&$DB); + $parentid = GLM_TEMPLATE::get_parent($catid,$DB); //echo $parentid.'
'; $query = "SELECT id,category,intro FROM bus_category WHERE parent = $parentid ".$this->active_query." ORDER BY pos"; $data = $DB->db_auto_get_data($query); @@ -1431,7 +1431,7 @@ class GLM_TEMPLATE{ { $url = $this->get_seo_url( $val['id'] ); $title = strip_tags(addslashes($val['intro'])); - if(GLM_TEMPLATE::is_sub_id($catid,$parentid,&$DB) && (GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) || $val['id'] == $catid) ) + if(GLM_TEMPLATE::is_sub_id($catid,$parentid,$DB) && (GLM_TEMPLATE::is_sub_id($catid,$val['id'],$DB) || $val['id'] == $catid) ) { $output .= ''; } @@ -1441,9 +1441,9 @@ class GLM_TEMPLATE{ } $output .= $val["category"]; $output .= ''; - if( GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) && GLM_TEMPLATE::has_subs($val['id'],&$DB)) + if( GLM_TEMPLATE::is_sub_id($catid,$val['id'],$DB) && GLM_TEMPLATE::has_subs($val['id'],$DB)) { - $output .= GLM_TEMPLATE::get_sub_nav($val["id"],&$DB,$catid); + $output .= GLM_TEMPLATE::get_sub_nav($val["id"],$DB,$catid); } } $output .= ''; @@ -1506,7 +1506,7 @@ class GLM_TEMPLATE{ } else { - return( GLM_TEMPLATE::get_top_parent($parentrow[0]['parent'],&$DB) ); + return( GLM_TEMPLATE::get_top_parent($parentrow[0]['parent'],$DB) ); } } @@ -1886,7 +1886,7 @@ class GLM_TEMPLATE{ $return .= ' id="current"'; } $return .= '>'.htmlentities($row['category'],ENT_QUOTES,'UTF-8').""; - if( $this->has_subs( $row['id'], &$this->DB ) && ( $this->is_sub_id( $this->catid, $row['id'], &$this->DB ) || $this->catid == $row['id'] ) ) + if( $this->has_subs( $row['id'], $this->DB ) && ( $this->is_sub_id( $this->catid, $row['id'], $this->DB ) || $this->catid == $row['id'] ) ) { $ret2 = $this->make_ul_menu( $row['id'] ); $return.=$ret2; @@ -1898,7 +1898,7 @@ class GLM_TEMPLATE{ if( $main_cats[$parent] ) { $return = ' '; @@ -1943,7 +1943,7 @@ class GLM_TEMPLATE{ { $outarray[] = ''.$string[$i]["label"].''; } - $outarray[] = $this->get_catheader( $catid, &$this->DB ); + $outarray[] = $this->get_catheader( $catid, $this->DB ); if( is_array( $outarray ) && count( $outarray ) > 1 ) { $out .= implode( " » ", $outarray ); @@ -1998,7 +1998,7 @@ class GLM_TEMPLATE{ WHERE trim(keyword) = '".trim($needle[1])."'"; $keyres = $this->DB->db_auto_get_data($qs); - $parent = $this->get_top_parent($keyres[0]['id'],&$this->DB); + $parent = $this->get_top_parent($keyres[0]['id'],$this->DB); $url = $this->get_seo_url( $keyres[0]['id'] ); $replacement = "".htmlspecialchars($keyres[0]['category']).""; $string = str_replace($needle[0],$replacement,$string); diff --git a/order-form.inc.php b/order-form.inc.php index 5457ad2..f264b25 100755 --- a/order-form.inc.php +++ b/order-form.inc.php @@ -77,7 +77,7 @@ $fields[] = array('name'=>'email_verify','title'=>'Verify Email Address','type'= // set default of mail_ok to true $data['mail_ok'] = 't'; -// $fields[] = array('title'=>'Ticket Amounts','type'=>'static_text'); +// $fields[] = array('title'=>'Ticket Amounts','type'=>'static_text'); $fields[] = array('name'=>'adult','title'=>'Adults $'.number_format( $adult_price, 2 ).'','type'=>'drop','info'=>$people_sel,'req'=>0); //$fields[] = array('name'=>'youth','title'=>'Youth (13-17) $'.number_format( $youth_price, 2) .'','type'=>'drop','info'=>$people_sel,'req'=>0); $fields[] = array('name'=>'child','title'=>'Children (5-12) $'.number_format( $child_price, 2 ).'','type'=>'drop','info'=>$people_sel,'req'=>0); @@ -94,7 +94,7 @@ $shipping_text = 'Shipping: Packages must be purchased at least '.$day $fields[] = array('title'=>$shipping_text,'type'=>'static_text'); $fields[] = array('title'=>''.$ship_type1.'','type'=>'static_text'); $fields[] = array('title'=>'
'.$ship_type2.'
','type'=>'static_text'); -// $fields[] = array('name'=>'ship_type','title'=>'Shipping Method','type'=>'drop','info'=>$ship_type_list,'req'=>1); +// $fields[] = array('name'=>'ship_type','title'=>'Shipping Method','type'=>'drop','info'=>$ship_type_list,'req'=>1); $fields[] = array('title'=>'Billing Address (must match your credit card billing information)','type'=>'static_text'); $fields[] = array('name'=>'bill_fname','title'=>'First Name','type'=>'text','req'=>1); $fields[] = array('name'=>'bill_lname','title'=>'Last Name','type'=>'text','req'=>1); @@ -118,9 +118,9 @@ switch( $_SERVER['GLM_SERVER_ID'] ) case "ws1.gaslightmedia.com": $thawt = ''; - //$thawt .= ''; + //$thawt .= ''; break; } $fields[] = array('title'=>'Payment Information
'.$thawt.'
','type'=>'static_text'); diff --git a/setup.phtml b/setup.phtml index 4d25edb..f292f75 100755 --- a/setup.phtml +++ b/setup.phtml @@ -103,7 +103,7 @@ if( !isset($SITEINFO) ) define("AUTH_TEST_MODE","TRUE"); define("BASE_SECURE_URL", $BASE_SECURE_URL."/"); define("BASE_INSECURE_URL", $BASE_URL."/"); - define("CONN_STR", "host=localhost user=nobody dbname=mackinacislandpackages"); // DB connection string + define("CONN_STR", "host=devdb user=nobody dbname=mackinacislandpackages"); // DB connection string define("OWNER_EMAIL", "dev@gaslightmedia.com"); // site owner's email address define("FROM_NEWS_EMAIL", "info@gaslightmedia.com"); // site owner's email address define("REPLY_TO", "info@gaslightmedia.com"); // the reply-to field for email's