function postbox_publish($this_invoice) { global $wpi_settings; $invoice_id = $this_invoice['invoice_id']; $status_names = apply_filters('wpi_invoice_statuses', $wpi_settings['invoice_statuses']); if (!empty($this_invoice['status'])) { $status_label = ( $status_names[$this_invoice['status']] ? $status_names[$this_invoice['status']] : $this_invoice['status']); } ?> <div id="submitpost" class="submitbox"> <div id="minor-publishing"> <ul class="wpi_publish_seetings"> <li class="wpi_hide_until_saved"><a target="_blank" class="wpi_new_win wpi_update_with_invoice_url" href="<?php echo get_invoice_permalink(!empty($this_invoice['invoice_id']) ? $this_invoice['invoice_id'] : '' ); ?>"><?php _e('View Online', WPI); ?></a></li> <?php do_action('wpi_publish_options', $this_invoice); ?> <li class="wpi_hide_until_saved"><span onclick="wpi_show_paycharge_box();" class="wpi_link" id="wpi_button_show_paycharge_box"><?php _e('Enter Payment', WPI); ?></span></li> <li class="wpi_hide_until_saved"><span onclick='wpi_show_notification_box();' class="wpi_link" id="wpi_button_show_notification"><?php _e('Send Notification', WPI); ?></span></li> <?php if ($wpi_settings['allow_deposits'] == 'true') { ?> <li class="wpi_not_for_recurring wpi_hide_deposit_option wpi_not_for_quote"> <?php $app_title = __("Allow Partial Payment", WPI); ?> <?php echo WPI_UI::checkbox("name=wpi_invoice[deposit]&value=true&label={$app_title}", ((!empty($this_invoice['deposit_amount']) && (int) $this_invoice['deposit_amount'] > 0) ? true : false)) ?></li> <li class="wpi_deposit_settings"> <table class="wpi_deposit_settings"> <tr> <th><?php _e("Minimum Payment", WPI); ?></th> <td><?php echo WPI_UI::input("id=wpi_meta_deposit_amount&name=wpi_invoice[deposit_amount]&value=" . (!empty($this_invoice['deposit_amount']) ? $this_invoice['deposit_amount'] : 0)); ?></td> </tr> </table> </li> <?php } ?> <?php if ($wpi_settings['show_recurring_billing'] == 'true') { ?> <li class="wpi_turn_off_recurring wpi_not_for_quote"><?php echo WPI_UI::checkbox("name=wpi_invoice[recurring][active]&value=true&label=Recurring Bill", (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['active'] : false)) ?></li> <li class="wpi_recurring_bill_settings <?php if (!empty($this_invoice['recurring']) && $this_invoice['recurring']['active'] != 'on') { ?>hidden<?php } ?>"> <table class="wpi_recurring_bill_settings"> <tr> <th><?php _e("Bill Every", WPI) ?></th> <td> <?php echo WPI_UI::input("name=wpi_invoice[recurring][length]&value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['length'] : '') . "&class=wpi_small wpi_bill_every_length"); ?> <?php echo WPI_UI::select("name=wpi_invoice[recurring][unit]&values=" . serialize(apply_filters('wpi_schedule_units', array("months" => __("Month(s)", WPI), "days" => __("Day(s)", WPI)))) . "¤t_value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['unit'] : '')); ?> </td> </tr> <tr> <th><?php _e("Billing Cycles", WPI) ?></th> <td><?php echo WPI_UI::input("id=wpi_meta_recuring_cycles&name=wpi_invoice[recurring][cycles]&value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['cycles'] : '') . "&class=wpi_small"); ?></td> </tr> <tr> <th>Send Invoice</th> <td> <script type="text/javascript">var recurring_send_invoice_automatically = '<?php echo!empty($this_invoice['recurring']['send_invoice_automatically']) ? $this_invoice['recurring']['send_invoice_automatically'] : 'on'; ?>';</script> <?php echo WPI_UI::checkbox("name=wpi_invoice[recurring][send_invoice_automatically]&value=true&label=".__('Automatically.', WPI), !empty($this_invoice['recurring']['send_invoice_automatically']) ? $this_invoice['recurring']['send_invoice_automatically'] : 'on'); ?> </td> </tr> <tr class="wpi_recurring_start_date" style="display:<?php echo!empty($this_invoice['recurring']) && $this_invoice['recurring']['send_invoice_automatically'] == 'on' ? 'none;' : ''; ?>"> <th>Date:</th> <td> <div> <?php echo WPI_UI::select("id=r_start_date_mm&name=wpi_invoice[recurring][start_date][month]&values=months¤t_value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['start_date']['month'] : '')); ?> <?php echo WPI_UI::input("id=r_start_date_jj&name=wpi_invoice[recurring][start_date][day]&value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['start_date']['day'] : '') . "&special=size='2' maxlength='2' autocomplete='off'") ?> <?php echo WPI_UI::input("id=r_start_date_aa&name=wpi_invoice[recurring][start_date][year]&value=" . (!empty($this_invoice['recurring']) ? $this_invoice['recurring']['start_date']['year'] : '') . "&special=size='2' maxlength='4' autocomplete='off'") ?><br /> <span onclick="wp_invoice_add_time('r_start_date', 7);" class="wp_invoice_click_me"><?php _e('In One Week', WPI); ?></span> | <span onclick="wp_invoice_add_time('r_start_date', 30);" class="wp_invoice_click_me"><?php _e('In 30 Days', WPI); ?></span> | <span onclick="wp_invoice_add_time('r_start_date', 'clear');" class="wp_invoice_click_me"><?php _e('Clear', WPI); ?></span> </div> </td> </tr> </table> </li> <?php } ?> </ul> <table class="form-table"> <thead> <th colspan="2"> <span id="wpi_button_show_advanced" class="wpi_link"><?php _e('Toggle Advanced', WPI); ?></span> </th> </thead> <tbody> <tr class="column-publish-due-date wpi_not_for_recurring wpi_not_for_quote"> <th>Due Date</th> <td> <div class="timestampdiv" style="display:block;"> <?php echo WPI_UI::select("id=due_date_mm&name=wpi_invoice[due_date_month]&values=months¤t_value=" . (!empty($this_invoice['due_date_month']) ? $this_invoice['due_date_month'] : '')); ?> <?php echo WPI_UI::input("id=due_date_jj&name=wpi_invoice[due_date_day]&value=" . (!empty($this_invoice['due_date_day']) ? $this_invoice['due_date_day'] : '') . "&special=size='2' maxlength='2' autocomplete='off'") ?> <?php echo WPI_UI::input("id=due_date_aa&name=wpi_invoice[due_date_year]&value=" . (!empty($this_invoice['due_date_year']) ? $this_invoice['due_date_year'] : '') . "&special=size='2' maxlength='4' autocomplete='off'") ?><br /> <span onclick="wp_invoice_add_time('due_date', 7);" class="wp_invoice_click_me"><?php _e('In One Week', WPI); ?></span> | <span onclick="wp_invoice_add_time('due_date', 30);" class="wp_invoice_click_me"><?php _e('In 30 Days', WPI); ?></span> | <span onclick="wp_invoice_add_time('due_date','clear');" class="wp_invoice_click_me"><?php _e('Clear', WPI); ?></span> </div> </td> </tr> <tr class="invoice_main column-publish-invoice_id"> <th><?php _e('Invoice ID', WPI); ?> </th> <td> <?php $custom_invoice_id = !empty($this_invoice['custom_id']) ? $this_invoice['custom_id'] : ''; if (empty($custom_invoice_id) && $wpi_settings['increment_invoice_id'] == 'true') { $highest_custom_id = WPI_Functions::get_highest_custom_id(); $custom_invoice_id = ($highest_custom_id ? ($highest_custom_id + 1) : $this_invoice['invoice_id']); echo WPI_UI::input("name=wpi_invoice[meta][custom_id]&value=$custom_invoice_id"); } else { ?> <input style="width: 80px;" class="input_field wp_invoice_custom_invoice_id<?php echo empty($this_invoice['custom_id'])?" wp_invoice_hidden":""; ?>" name="wpi_invoice[meta][custom_id]" value="<?php echo !empty($this_invoice['custom_id']) ? $this_invoice['custom_id'] : ''; ?>"> <span class="wp_invoice_custom_invoice_id"> <?php echo $this_invoice['invoice_id']; ?> </span> <a onClick="jQuery('.wp_invoice_custom_invoice_id').toggle(); return false;" class="wp_invoice_click_me <?php echo empty($this_invoice['custom_id'])?" wp_invoice_hidden":""; ?>" href="#"><?php _e('Custom Invoice ID', WPI); ?></a> <?php } ?> </td> </tr> <tr class="invoice_main column-publish-global_tax"> <th><?php _e('Global Tax', WPI); ?></th> <td> <?php echo WPI_UI::input("id=wp_invoice_tax&name=wpi_invoice[meta][tax]&value=" . (!empty($this_invoice['tax']) ? $this_invoice['tax'] : '')) ?> </td> </tr> <tr class="invoice_main column-publish-global_tax"> <th><?php _e('Tax Method', WPI); ?></th> <td> <?php $tax_method = !empty($this_invoice['tax_method']) ? $this_invoice['tax_method'] : (isset($wpi_settings['tax_method']) ? $wpi_settings['tax_method'] : ''); ?> <?php echo WPI_UI::select("id=wpi_tax_method&name=wpi_invoice[tax_method]&values=" . serialize(array('before_discount' => __('Before Discount', WPI), 'after_discount' => __('After Discount', WPI))) . "¤t_value={$tax_method}"); ?> </td> </tr> </tbody> </table> </div> <div id="major-publishing-actions" class="clearfix"> <div id="delete-action" class="wpi_hide_until_saved"> <a href="<?php echo admin_url($wpi_settings['links']['overview_page']) . "&action=trash&post=" . (!empty($this_invoice['ID']) ? $this_invoice['ID'] : '') . "&_wpnonce=" . wp_create_nonce('wpi-status-change-' . (!empty($this_invoice['ID']) ? $this_invoice['ID'] : '')); ?>" class="submitdelete deletion"><?php _e('Trash Invoice', WPI); ?></a> </div> <div id="publishing-action"> <input type="submit" class="alignright button-primary" value="<?php esc_attr(_e('Save', WPI)); ?>" id="wpi_save_invoice"> </div> </div> </div> <?php }