<script src="./javascript/prototype.js" type="text/javascript"></script> <script src="./javascript/scriptaculous.js" type="text/javascript"></script> <!-- DO NOT REMOVE THIS LINE --> <!-- #dependencies --> <script type="text/javascript"> site_url = '<?php echo $this->config->site_url(); ?> '; username = '******'; </script> <script type="text/javascript" charset="utf-8"><?php echo isset($js) ? $js : ''; ?> </script> <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="<?php echo $this->config->site_url(); ?> css/lt7.css" /><![endif]--> <?php echo isset($this->validation->event_date) ? @js_calendar_script('my_form') : ''; ?> </head>
<?php echo '<div class="breadcrumbs">' . $page_title . '</div>'; echo js_calendar_script('my_form'); $attributes = array('id' => 'my_form', 'name' => 'my_form'); if ($id) { echo form_open_multipart("/CMS/case_study/edit/{$id}", $attributes); } else { echo form_open_multipart('/CMS/case_study/new_case_study', $attributes); } $data = array('name' => 'submit', 'value' => 'Save changes', 'class' => 'submit'); echo form_submit($data); echo '<div id="admin_edit">'; echo '<div class="status clear_only">Client Name:</div>'; echo "<div id='admin_title'>"; echo form_input('title', $case_study->title); echo "</div>"; ?> <div class="sidebar"> <div class="block cms_blue"> <div class="status clear">Status: <?php $options = array('draft' => 'Draft', 'publish' => 'Publish', 'private' => 'Private', 'trash' => 'Trash'); echo form_dropdown('status', $options, $case_study->status); if ($case_study->id) { echo "<br /><a href=\"/projects/preview/{$case_study->id}\">preview</a>"; } ?>
function duplicate($id) { $this->load->library('validation'); $this->load->plugin('js_calendar'); // grab invoice info $data['row'] = $this->invoices_model->getSingleInvoice($id)->row(); $data['action'] = 'duplicate'; // some hidden form data $data['form_hidden'] = array('tax1_rate' => $data['row']->tax1_rate, 'tax1_description' => $data['row']->tax1_desc, 'tax2_rate' => $data['row']->tax2_rate, 'tax2_description' => $data['row']->tax2_desc); $taxable = $this->clients_model->get_client_info($data['row']->client_id, 'tax_status')->tax_status == 1 ? 'true' : 'false'; $data['extraHeadContent'] = "<link type=\"text/css\" rel=\"stylesheet\" href=\"" . base_url() . "css/calendar.css\" />\n"; $data['extraHeadContent'] .= "<script type=\"text/javascript\">\nvar taxable = " . $taxable . ";\nvar tax1_rate = " . $data['row']->tax1_rate . ";\nvar tax2_rate = " . $data['row']->tax2_rate . ";\nvar datePicker1 = \"" . date("Y-m-d", mysql_to_unix($data['row']->dateIssued)) . "\";\nvar datePicker2 = \"" . date("F j, Y", mysql_to_unix($data['row']->dateIssued)) . "\";\n\n</script>"; $data['extraHeadContent'] .= "<link type=\"text/css\" rel=\"stylesheet\" href=\"" . base_url() . "css/invoice.css\" />\n"; $data['extraHeadContent'] .= "<script type=\"text/javascript\" src=\"" . base_url() . "js/createinvoice.js\"></script>\n"; $data['extraHeadContent'] .= js_calendar_script('my_form'); $data['clientListEdit'] = $this->clients_model->getAllClients(); $this->_validation_edit(); // Load the validation rules and fields $last_invoice_number = $this->invoices_model->lastInvoiceNumber($id); $last_invoice_number != '' ? $data['lastInvoiceNumber'] = $last_invoice_number : ($data['lastInvoiceNumber'] = ''); $data['invoice_number'] = is_numeric($last_invoice_number) ? $last_invoice_number + 1 : ''; $data['last_number_suggestion'] = '(' . $this->lang->line('invoice_last_used') . ' ' . $last_invoice_number . ')'; $data['page_title'] = $this->lang->line('menu_duplicate_invoice'); $data['button_label'] = 'actions_create_invoice'; if ($this->validation->run() == FALSE) { $data['items'] = $this->invoices_model->getInvoiceItems($id); // begin amount and taxes $data['total_no_tax'] = $this->lang->line('invoice_amount') . ': ' . $this->settings_model->get_setting('currency_symbol') . number_format($data['row']->total_notax, 2, $this->config->item('currency_decimal'), '') . "<br />\n"; $data['tax_info'] = $this->_tax_info($data['row']); $data['total_with_tax'] = $this->lang->line('invoice_total') . ': ' . $this->settings_model->get_setting('currency_symbol') . number_format($data['row']->total_with_tax, 2, $this->config->item('currency_decimal'), ''); // end amount and taxes $this->load->view('invoices/edit', $data); } else { if ($this->invoices_model->uniqueInvoiceNumber($this->input->post('invoice_number'), $this->input->post('id'))) { $invoice_data = array('client_id' => $this->input->post('client_id'), 'invoice_number' => $this->input->post('invoice_number'), 'dateIssued' => $this->input->post('dateIssued'), 'tax1_desc' => $this->input->post('tax1_description'), 'tax1_rate' => $this->input->post('tax1_rate'), 'tax2_desc' => $this->input->post('tax2_description'), 'tax2_rate' => $this->input->post('tax2_rate'), 'invoice_note' => $this->input->post('invoice_note'), 'recur_interval' => $this->input->post('recur_interval'), 'type' => $this->input->post('type')); $invoice_id = $this->invoices_model->addInvoice($invoice_data); if ($invoice_id > 0) { $items = $this->input->post('items'); $amount = 0; foreach ($items as $item) { $taxable = isset($item['taxable']) && $item['taxable'] == 1 ? 1 : 0; $invoice_items = array('invoice_id' => htmlspecialchars($invoice_id), 'quantity' => htmlspecialchars($item['quantity']), 'amount' => htmlspecialchars($item['amount']), 'work_description' => htmlspecialchars($item['work_description']), 'taxable' => htmlspecialchars($taxable)); $this->invoices_model->addInvoiceItem($invoice_items); } } // give a session telling them it worked $this->session->set_flashdata('message', $this->lang->line('invoice_invoice_edit_success')); redirect('invoices/view/' . $invoice_id); } else { $data['invoice_number_error'] = TRUE; $data['items'] = $this->invoices_model->getInvoiceItems($id); // begin amount and taxes $data['total_no_tax'] = $this->lang->line('invoice_amount') . ': ' . $this->settings_model->get_setting('currency_symbol') . number_format($data['row']->total_notax, 2, $this->config->item('currency_decimal'), '') . "<br />\n"; $data['tax_info'] = $this->_tax_info($data['row']); $data['total_with_tax'] = $this->lang->line('invoice_total') . ': ' . $this->settings_model->get_setting('currency_symbol') . number_format($data['row']->total_with_tax, 2, $this->config->item('currency_decimal'), ''); // end amount and taxes $this->load->view('invoices/edit', $data); } } }
<?php echo js_calendar_script('search_event_form'); ?> <?php echo form_open('events/search', array('name' => 'search_event_form', 'id' => 'search_event_form')); echo form_dropdown('city', $cities); echo js_calendar_write('entry_date', time(), true);