コード例 #1
0
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!$quote_safe) {
    die('failed');
}
if (!module_quote::can_i('edit', 'Quotes')) {
    die('no perms');
}
$quote_id = (int) $_REQUEST['quote_id'];
$quote = module_quote::get_quote($quote_id);
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'quote_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'quote_email';
$template = module_template::get_template_by_key($template_name);
$quote['total_amount_print'] = dollar($quote['total_amount'], true, $quote['currency_id']);
$quote['total_amount_due_print'] = dollar($quote['total_amount_due'], true, $quote['currency_id']);
$quote['quote_name'] = $quote['name'];
$quote['from_name'] = module_security::get_loggedin_name();
$quote['quote_url'] = module_quote::link_public($quote_id);
ob_start();
include module_theme::include_ucm('includes/plugin_quote/template/quote_task_list.php');
コード例 #2
0
                $history = module_subscription::get_subscription_history($subscription_id, 'website', $website_id);
                foreach ($history as $h) {
                    if (is_array($h) && isset($h['invoice_id']) && $h['invoice_id']) {
                        $note_summary_owners['invoice'][$h['invoice_id']] = $h['invoice_id'];
                    }
                }
            }
        }
        module_note::display_notes(array('title' => module_config::c('project_name_single', 'Website') . ' Notes', 'owner_table' => 'website', 'owner_id' => $website_id, 'view_link' => module_website::link_open($website_id), 'display_summary' => true, 'summary_owners' => $note_summary_owners));
    }
    if (class_exists('module_quote', false) && module_quote::is_plugin_enabled() && module_quote::can_i('view', 'Quotes')) {
        // show the jobs linked to this website.
        $quotes = module_quote::get_quotes(array('website_id' => $website_id));
        if (count($quotes) || module_quote::can_i('create', 'Quotes')) {
            $h = array('type' => 'h3', 'title' => module_config::c('project_name_single', 'Website') . ' Quotes');
            if (module_quote::can_i('create', 'Quotes')) {
                $h['button'] = array('title' => 'New Quote', 'url' => module_quote::link_generate('new', array('arguments' => array('website_id' => $website_id))));
            }
            $fieldset_data = array('heading' => $h);
            if (count($quotes)) {
                $c = 0;
                ob_start();
                ?>

				    <div class="content_box_wheader">
					    <table border="0" cellspacing="0" cellpadding="2"
					           class="tableclass tableclass_rows tableclass_full">
						    <thead>
						    <tr>
							    <th>
								    <?php 
コード例 #3
0
    // that isn't in the default invoice listing.
    foreach ($quotes as $quote_id => $quote) {
        $quotes[$quote_id] = array_merge($quote, module_quote::get_quote($quote['quote_id']));
        $quotes[$quote_id]['website_name'] = $quote['website_name'];
    }
    module_table_sort::enable_pagination_hook(array('table_id' => 'quote_list', 'sortable' => array('quote_title' => array('field' => 'name', 'current' => 1), 'quote_start_date' => array('field' => 'date_create'), 'quote_completed_date' => array('field' => 'date_approved'), 'quote_website' => array('field' => 'website_name'), 'quote_customer' => array('field' => 'customer_name'), 'quote_type' => array('field' => 'type'), 'quote_status' => array('field' => 'status'), 'quote_progress' => array('field' => 'total_percent_complete'), 'quote_total' => array('field' => 'total_amount'), 'quote_total_amount_invoiced' => array('field' => 'total_amount_invoiced'), 'quote_group' => array('group_sort' => true, 'owner_table' => 'quote', 'owner_id' => 'quote_id'))));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_quote::can_i('view', 'Export Quotes')) {
    module_import_export::enable_pagination_hook(array('name' => 'Quote Export', 'fields' => array('Quote ID' => 'quote_id', 'Quote Title' => 'name', 'Hourly Rate' => 'hourly_rate', 'Start Date' => 'date_create', 'Completed Date' => 'date_approved', module_config::c('project_name_single', 'Website') . ' Name' => 'website_name', 'Customer Name' => 'customer_name', 'Type' => 'type', 'Status' => 'status', 'Staff Member' => 'staff_member', 'Tax Name' => 'total_tax_name', 'Tax Percent' => 'total_tax_rate', 'Renewal Date' => 'date_renew'), 'extra' => array('owner_table' => 'quote', 'owner_id' => 'quote_id')));
}
$header = array('title' => _l('Customer Quotes'), 'main' => true, 'button' => array());
if (module_quote::can_i('create', 'Quotes')) {
    $header['button'][] = array('url' => module_quote::link_open('new'), 'title' => 'Add New Quote', 'type' => 'add');
}
if (class_exists('module_import_export', false) && module_quote::can_i('view', 'Import Quotes')) {
    $link = module_import_export::import_link(array('callback' => 'module_quote::handle_import', 'callback_preview' => 'module_quote::handle_import_row_debug', 'name' => 'Quotes', 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'quote', 'fields' => array('Quote Title' => 'name', 'Hourly Rate' => 'hourly_rate', 'Start Date' => 'date_create', 'Completed Date' => 'date_approved', module_config::c('project_name_single', 'Website') . ' Name' => 'website_name', 'Customer Name' => 'customer_name', 'Type' => 'type', 'Status' => 'status', 'Staff Member' => 'staff_member', 'Tax Name' => 'total_tax_name', 'Tax Percent' => 'total_tax_rate', 'Renewal Date' => 'date_renew'), 'extra' => array('owner_table' => 'quote', 'owner_id' => 'quote_id')));
    $header['button'][] = array('url' => $link, 'title' => 'Import Quotes', 'type' => 'add');
}
print_heading($header);
?>



<form action="" method="post">

<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Quote Title:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 30)), 'type' => array('title' => _l('Type:'), 'field' => array('type' => 'select', 'name' => 'search[type]', 'value' => isset($search['type']) ? $search['type'] : '', 'options' => module_quote::get_types())), 'status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status]', 'value' => isset($search['status']) ? $search['status'] : '', 'options' => module_quote::get_statuses())), 'accepted' => array('title' => _l('Accepted:'), 'field' => array('type' => 'select', 'name' => 'search[accepted]', 'value' => isset($search['accepted']) ? $search['accepted'] : '', 'options' => array(1 => _l('Both Accepted and Un-Accepted Quotes'), 2 => _l('Only Accepted Quotes'), 3 => _l('Only Un-Accepted Quotes'))))));
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
コード例 #4
0
        echo _l('Assign Quote');
        ?>

                    </th>
                    <td>
                        <?php 
        $c = array();
        $quotes = module_quote::get_quotes(array('customer_id' => $job['customer_id']));
        foreach ($quotes as $quote) {
            $c[$quote['quote_id']] = $quote['name'];
        }
        echo print_select_box($c, 'quote_id', $job['quote_id']);
        ?>

                        <?php 
        if ($job['quote_id'] && module_quote::can_i('view', 'Quotes')) {
            ?>

                        <a href="<?php 
            echo module_quote::link_open($job['quote_id'], false);
            ?>
"><?php 
            _e('Open');
            ?>
</a>
                        <?php 
        }
        ?>

                    </td>
                </tr>
コード例 #5
0
ファイル: quote.php プロジェクト: sgh1986915/php-crm
 private static function save_quote_tasks($quote_id, $data)
 {
     $result = array('status' => false);
     $check_completed = false;
     $quote_data = false;
     // check for new tasks or changed tasks.
     $tasks = self::get_tasks($quote_id);
     if (isset($data['quote_task']) && is_array($data['quote_task'])) {
         foreach ($data['quote_task'] as $quote_task_id => $task_data) {
             if (isset($task_data['manual_percent']) && strlen($task_data['manual_percent']) == 0) {
                 unset($task_data['manual_percent']);
             }
             $original_quote_task_id = $quote_task_id;
             $quote_task_id = (int) $quote_task_id;
             if (!is_array($task_data)) {
                 continue;
             }
             if ($quote_task_id > 0 && !isset($tasks[$quote_task_id])) {
                 $quote_task_id = 0;
                 // creating a new task on this quote.
             }
             if (!isset($task_data['description']) || $task_data['description'] == '' || $task_data['description'] == _TASK_DELETE_KEY) {
                 if ($quote_task_id > 0 && $task_data['description'] == _TASK_DELETE_KEY) {
                     // remove task.
                     // but onyl remove it if it hasn't been invoiced.
                     $sql = "DELETE FROM `" . _DB_PREFIX . "quote_task` WHERE quote_task_id = '{$quote_task_id}' AND quote_id = {$quote_id} LIMIT 1";
                     query($sql);
                     $result['status'] = 'deleted';
                     $result['quote_task_id'] = $quote_task_id;
                 }
                 continue;
             }
             // add / save this task.
             $task_data['quote_id'] = $quote_id;
             $task_data['hours'] = function_exists('decimal_time_in') ? decimal_time_in($task_data['hours']) : $task_data['hours'];
             // remove the amount of it equals the hourly rate.
             if (isset($task_data['amount']) && $task_data['amount'] != 0 && isset($task_data['hours']) && $task_data['hours'] > 0) {
                 if (isset($data['hourly_rate']) && $task_data['amount'] - $task_data['hours'] * $data['hourly_rate'] == 0) {
                     unset($task_data['amount']);
                 }
             }
             // check if we haven't unticked a non-hourly task
             // check if we haven't unticked a billable task
             if (isset($task_data['billable_t']) && $task_data['billable_t'] && !isset($task_data['billable'])) {
                 $task_data['billable'] = 0;
             }
             // set default taxable status
             if (!isset($task_data['taxable_t'])) {
                 // we're creating a new task.
                 $task_data['taxable'] = module_config::c('task_taxable_default', 1);
             }
             if (isset($task_data['taxable_t']) && $task_data['taxable_t'] && !isset($task_data['taxable'])) {
                 $task_data['taxable'] = 0;
             }
             // todo: move the task creation code into a public method so that the public user can add tasks to their quotes.
             if (!$quote_task_id && module_security::is_logged_in() && !module_quote::can_i('create', 'Quote Tasks')) {
                 continue;
                 // dont allow new tasks.
             }
             // check if the user is allowed to create new tasks.
             $quote_task_id = update_insert('quote_task_id', $quote_task_id, 'quote_task', $task_data);
             // todo - fix cross task quote boundary issue. meh.
             $result['quote_task_id'] = $quote_task_id;
             if ($quote_task_id != $original_quote_task_id) {
                 $result['status'] = 'created';
             } else {
                 $result['status'] = 'edited';
             }
         }
     }
     if ($check_completed) {
         self::update_quote_completion_status($quote_id);
     }
     module_cache::clear('quote');
     return $result;
 }
コード例 #6
0
ファイル: quote_admin.php プロジェクト: sgh1986915/php-crm
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
$quote_safe = true;
// stop including files directly.
if (!module_quote::can_i('view', 'Quotes')) {
    echo 'permission denied';
    return;
}
if (isset($_REQUEST['quote_id'])) {
    if (isset($_REQUEST['email_staff'])) {
        include module_theme::include_ucm("includes/plugin_quote/pages/quote_admin_email_staff.php");
    } else {
        if (isset($_REQUEST['email'])) {
            include module_theme::include_ucm("includes/plugin_quote/pages/quote_admin_email.php");
        } else {
            if ((int) $_REQUEST['quote_id'] > 0) {
                include module_theme::include_ucm("includes/plugin_quote/pages/quote_admin_edit.php");
                //include("quote_admin_edit.php");
            } else {
                include module_theme::include_ucm("includes/plugin_quote/pages/quote_admin_create.php");
                //include("quote_admin_create.php");
            }
コード例 #7
0
ファイル: ajax_task_edit.php プロジェクト: sgh1986915/php-crm
    ?>
        <td rowspan="2" valign="top" style="padding:0.3em 0;">
            <input type="text" name="quote_task[<?php 
    echo $quote_task_id;
    ?>
][task_order]" value="<?php 
    echo $task_data['task_order'];
    ?>
" size="3" class="edit_task_order">
        </td>
    <?php 
}
?>
    <td>
        <?php 
if ($task_editable && module_quote::can_i('delete', 'Quote Tasks')) {
    ?>
        <a href="#" onclick="if(confirm('<?php 
    _e('Delete Task?');
    ?>
')){$(this).parent().find('input').val('<?php 
    echo _TASK_DELETE_KEY;
    ?>
'); $('#quote_task_form')[0].submit();} return false;" class="delete ui-state-default ui-corner-all ui-icon ui-icon-trash" style="display:inline-block; float:right;">[x]</a>
        <?php 
}
?>
        <input type="text" class="edit_task_description" name="quote_task[<?php 
echo $quote_task_id;
?>
][description]" value="<?php 
コード例 #8
0
                                <input type="hidden" name="quote_task[new][manual_task_type]" value="-1" id="manual_task_type_new">
                            </td>
                        </tr>
						</tbody>
                        <?php 
    }
    ?>

                        <tbody class="quote_task_wrapper">
                        <?php 
    $c = 0;
    $task_number = 0;
    foreach ($quote_tasks as $quote_task_id => $task_data) {
        $task_number++;
        //module_security::is_page_editable() &&
        if (module_quote::can_i('edit', 'Quote Tasks') && $quote['date_approved'] == '0000-00-00') {
            $task_editable = true;
        } else {
            $task_editable = false;
        }
        echo module_quote::generate_task_preview($quote_id, $quote, $quote_task_id, $task_data, $task_editable);
    }
    ?>

                        </tbody>
                        </table>
                        <?php 
    if ((int) $quote_id > 0) {
        ?>
 <div id="quote_summary"> <?php 
        echo module_quote::generate_quote_summary($quote_id, $quote);