/** * Get a static reference to the storage object associated with this model object * * @return the storage object */ public static function get_instance() { if (self::$so == null) { self::$so = CreateObject('rental.sobilling'); $virtual_file_system = CreateObject('phpgwapi.vfs'); $virtual_file_system->override_acl = 1; self::$so->vfs = $virtual_file_system; } return self::$so; }
echo lang('month'); ?> </dt> <dd><?php echo lang('month ' . $month . ' capitalized'); ?> </dd> <dt> <label for="billing_term"><?php echo lang('billing_term'); ?> </label> </dt> <dd> <?php foreach (rental_sobilling::get_instance()->get_billing_terms() as $term_id => $term_title) { if ($term_id == $billing_term) { echo lang($term_title); } } ?> </dd> <?php } else { ?> <dt><?php echo lang('billing_term'); ?> </dt> <dd><?php echo $billing_term_label;
public function download_export() { if (!$this->isExecutiveOfficer()) { $this->render('permission_denied.php'); return; } //$browser = CreateObject('phpgwapi.browser'); //$browser->content_header('export.txt','text/plain'); $stop = phpgw::get_var('date'); $cs15 = phpgw::get_var('generate_cs15'); if ($cs15 == null) { $export_format = explode('_', phpgw::get_var('export_format')); $file_ending = $export_format[1]; if ($file_ending == 'gl07') { $type = 'intern'; } else { if ($file_ending == 'lg04') { $type = 'faktura'; } } $date = date('Ymd', $stop); header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=PE_{$type}_{$date}.{$file_ending}"); $id = phpgw::get_var('id'); $path = "/rental/billings/{$id}"; $vfs = CreateObject('phpgwapi.vfs'); $vfs->override_acl = 1; print $vfs->read(array('string' => $path, RELATIVE_NONE)); //print rental_sobilling::get_instance()->get_export_data((int)phpgw::get_var('id')); } else { $file_ending = 'cs15'; $type = 'kundefil'; $date = date('Ymd', $stop); header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=PE_{$type}_{$date}.{$file_ending}"); print rental_sobilling::get_instance()->generate_customer_export((int) phpgw::get_var('id')); } }
/** * Get HTML radiobox with default billing term for new contracts * * @param $config * @return string HTML checkboxes to be placed in a table */ function default_billing_term($config) { phpgw::import_class('rental.sobilling'); $billing_terms = rental_sobilling::get_instance()->get_billing_terms(); $term_assigned = isset($config['default_billing_term']) ? $config['default_billing_term'] : array(); $lang_none = lang('none'); $out = "<tr><td><input type=\"radio\" name=\"newsettings[default_billing_term]\" value=\"\"><label>{$lang_none}</label></td></tr>"; foreach ($billing_terms as $term_id => $_label) { $label = $GLOBALS['phpgw']->translation->translate($_label, array(), false, 'rental'); $checked = ''; if ($term_id == $term_assigned) { $checked = ' checked'; } $out .= <<<HTML \t\t\t<tr><td><input type="radio" name="newsettings[default_billing_term]" value="{$term_id}" {$checked}><label>{$label}</label></td></tr> HTML; } return $out; }
foreach ($fields as $id => $label) { if ($id == $billing_job->get_location_id()) { echo lang($label); } } ?> </dd> <dt> <?php echo lang('billing_terms'); ?> </dt> <dd> <?php if ($billing_info_array != null) { $billing_terms = rental_sobilling::get_instance()->get_billing_terms(); foreach ($billing_info_array as $billing_info) { if ($billing_info->get_term_id() == 1) { echo lang('month ' . $billing_info->get_month() . ' capitalized'); } else { //echo lang($billing_terms[$billing_info->get_term_id()]); echo $billing_info->get_term_label(); } echo " " . $billing_info->get_year() . "<br/>"; } } ?> </dd> </dl> <dl class="proplist-col"> <dt>
public function download_export() { if (!$this->isExecutiveOfficer()) { $this->render('permission_denied.php'); return; } //$browser = CreateObject('phpgwapi.browser'); //$browser->content_header('export.txt','text/plain'); $stop = phpgw::get_var('date'); $cs15 = phpgw::get_var('generate_cs15'); $toExcel = phpgw::get_var('toExcel'); if ($cs15 == null) { if ($toExcel == null) { $export_format = explode('_', phpgw::get_var('export_format')); $file_ending = $export_format[1]; if ($file_ending == 'gl07') { $type = 'intern'; } else { if ($file_ending == 'lg04') { $type = 'faktura'; } } $date = date('Ymd', $stop); header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=PE_{$type}_{$date}.{$file_ending}"); $id = phpgw::get_var('id'); $path = "/rental/billings/{$id}"; $vfs = CreateObject('phpgwapi.vfs'); $vfs->override_acl = 1; print $vfs->read(array('string' => $path, RELATIVE_NONE)); //print rental_sobilling::get_instance()->get_export_data((int)phpgw::get_var('id')); } else { $billing_job = rental_sobilling::get_instance()->get_single((int) phpgw::get_var('id')); $billing_info_array = rental_sobilling_info::get_instance()->get(null, null, null, null, null, null, array('billing_id' => phpgw::get_var('id'))); $type = phpgw::get_var('type', 'string', 'GET', 'bk'); if ($billing_job == null) { $errorMsgs[] = lang('Could not find specified billing job.'); } else { //Loop through billing info array to find the first month $month = 12; foreach ($billing_info_array as $billing_info) { $year = $billing_info->get_year(); if ($month > $billing_info->get_month()) { $month = $billing_info->get_month(); } } $billing_job->set_year($year); $billing_job->set_month($month); $list = rental_sobilling::get_instance()->generate_export($billing_job, $type); //_debug_array($list[0]); /*foreach ($list as $l) { _debug_array($l); }*/ if (isset($list)) { $infoMsgs[] = lang('Export generated.'); $keys = array(); if (count($list[0]) > 0) { foreach ($list[0] as $key => $value) { if (!is_array($value)) { array_push($keys, $key); } } } // Remove newlines from output // $count = count($list); // for($i = 0; $i < $count; $i++) // { // foreach ($list[$i] as $key => &$data) // { // $data = str_replace(array("\n","\r\n", "<br>"),'',$data); // } // } // Use keys as headings $headings = array(); $count_keys = count($keys); for ($j = 0; $j < $count_keys; $j++) { array_push($headings, lang($keys[$j])); } // _debug_array($list); $property_common = CreateObject('property.bocommon'); $property_common->download($list, $keys, $headings); } else { $errorMsgs = lang('Export failed.'); } } } } else { $file_ending = 'cs15'; $type = 'kundefil'; $date = date('Ymd', $stop); header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=PE_{$type}_{$date}.{$file_ending}"); print rental_sobilling::get_instance()->generate_customer_export((int) phpgw::get_var('id')); } }