From fa8fc960fa1d4d4fb80d3fbe36b00d0c5645b355 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Sun, 13 Nov 2011 09:45:15 +1100 Subject: [PATCH 1/7] Changes --- models/currency.php | 2 +- views/costings/add.ctp | 13 +- views/layouts/default.ctp | 177 +++--- views/line_items/get_table.ctp | 259 +++++---- views/users/login.ctp | 5 + webroot/css/quotenik.css | 8 +- webroot/js/document_add_edit.js | 987 ++++++++++++++++---------------- 7 files changed, 730 insertions(+), 721 deletions(-) diff --git a/models/currency.php b/models/currency.php index 5e985103..9e19a6c3 100755 --- a/models/currency.php +++ b/models/currency.php @@ -32,7 +32,7 @@ class Currency extends AppModel { ); - var $order = "Currency.name ASC"; + var $order = "name ASC"; } ?> diff --git a/views/costings/add.ctp b/views/costings/add.ctp index 6a2e631b..9c64cffa 100755 --- a/views/costings/add.ctp +++ b/views/costings/add.ctp @@ -99,14 +99,5 @@ echo $form->input('sale_discount_amount', array('type'=>'hidden')); echo $form->end('Submit');?> -
- -
+ + diff --git a/views/layouts/default.ctp b/views/layouts/default.ctp index 60756b31..8272497a 100755 --- a/views/layouts/default.ctp +++ b/views/layouts/default.ctp @@ -1,42 +1,40 @@ - - + - + - <?php __('CMC'); ?> - <?php echo $title_for_layout; ?> + <?php __('CMC'); ?> + <?php echo $title_for_layout; ?> - 0) { - echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon')); - } else { - echo $html->meta('icon'); - } +if ($debugLevel > 0) { + echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon')); +} else { + echo $html->meta('icon'); +} - echo $html->css('quotenik'); - echo $html->css('jquery-ui.custom.css'); +echo $html->css('quotenik'); +echo $html->css('jquery-ui.custom.css'); - //echo $javascript->link('ckeditor/ckeditor'); +//echo $javascript->link('ckeditor/ckeditor'); - echo $javascript->link('jquery'); +echo $javascript->link('jquery'); - echo $javascript->link('jquery-ui'); - echo $javascript->link('jquery.form'); - echo $javascript->link('menu'); - echo $javascript->link('global'); - echo $javascript->link('search'); - echo $javascript->link('jquery.jeditable.mini'); - echo $javascript->link('jquery.validate'); +echo $javascript->link('jquery-ui'); +echo $javascript->link('jquery.form'); +echo $javascript->link('menu'); +echo $javascript->link('global'); +echo $javascript->link('search'); +echo $javascript->link('jquery.jeditable.mini'); +echo $javascript->link('jquery.validate'); - echo $scripts_for_layout; - ?> +echo $scripts_for_layout; +?> @@ -48,14 +46,14 @@
- link('Login', '/users/login'); - } else { - $logoutlink = $html->link('Logout', '/users/logout'); - echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')'; - } - ?> +link('Login', '/users/login'); +} else { + $logoutlink = $html->link('Logout', '/users/logout'); + echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')'; +} +?>
- check('Message.flash')): - $session->flash(); - endif; - ?> +check('Message.flash')): + $session->flash(); +endif; +?>
-

Loading, please wait

- image('ajax-loader.gif'); ?> -
- +

Loading, please wait

+ image('ajax-loader.gif'); ?> +
+ @@ -191,51 +189,52 @@ - create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false')); - echo '

Search'; - echo $html->image('system-search.png'); - echo '

'; - echo "

Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number

"; +create('Enquiry', array('default' => false, 'id' => 'searchForm', 'default' => 'false')); +echo '

Search'; +echo $html->image('system-search.png'); +echo '

'; +echo "

Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number

"; - echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString')); - ?> +echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString')); +?>
- end(); - ?> +end(); +?>
-

Loading, please wait..

- image('ajax-loader.gif'); ?> -
+

Loading, please wait..

+ image('ajax-loader.gif'); ?> +
- "; - ?> +$mem_usage = memory_get_usage(true); + +if ($mem_usage < 1024) + echo $mem_usage . " bytes"; +elseif ($mem_usage < 1048576) + echo round($mem_usage / 1024, 2) . " kilobytes"; +else + echo round($mem_usage / 1048576, 2) . " megabytes"; +echo "
"; +?> - + - + diff --git a/views/line_items/get_table.ctp b/views/line_items/get_table.ctp index 97f3e289..e7411cdb 100644 --- a/views/line_items/get_table.ctp +++ b/views/line_items/get_table.ctp @@ -1,143 +1,152 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - - - + $hasOptions = true; +} +?> + + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + - - - - - - - - - - +?> + + + + + + + + + + +
ITEM
NO.
QTYDESCRIPTIONUNIT
PRICE
TOTAL
PRICE
ACTIONS
ITEM
NO.
QTYDESCRIPTIONUNIT
PRICE
TOTAL
PRICE
ACTIONS
- '; +if(count($document['LineItem']) == 0): +?> +
No Line Items have been Added Yet!
+'; - $hasOptions = true; - } - ?> - -
- -
- - - currency($li['gross_unit_price'], $currencyCode);?> - -
less
%
- discount
- (-currency($li['discount_amount_unit'], $currencyCode);?>)
- =
- currency($li['net_unit_price'], $currencyCode);?> - - -
- - - currency($li['gross_price'], $currencyCode);?> - -
less
%
- discount
- currency($li['discount_amount_total'], $currencyCode);?>)
- =
- currency($li['net_price'], $currencyCode);?> - - -
-
- -
+
+ +
+ + + currency($li['gross_unit_price'], $currencyCode);?> + +
less
%
+ discount
+ (-currency($li['discount_amount_unit'], $currencyCode);?>)
+ =
+ currency($li['net_unit_price'], $currencyCode);?> + + +
+ + + currency($li['gross_price'], $currencyCode);?> + +
less
%
+ discount
+ currency($li['discount_amount_total'], $currencyCode);?>)
+ =
+ currency($li['net_price'], $currencyCode);?> + + +
+
+ +
SUB-TOTAL (Excluding GST)currency($totals['subtotal'], $currencyCode); - } - else { - echo $currencySymbol.'TBA'; - } - ?> -
SUB-TOTAL (Excluding GST)currency($totals['subtotal'], $currencyCode); + } + else { + echo $currencySymbol.'TBA'; + } +?> +
GST (10%) - currency($totals['gst'], $currencyCode); - } - else { - echo $currencySymbol.'TBA'; - } +
GST (10%) +currency($totals['gst'], $currencyCode); +} +else { + echo $currencySymbol.'TBA'; +} - ?> -
TOTAL PAYABLE (INCLUDING GST)currency($totals['total'], $currencyCode); - } - else { - echo $currencySymbol.'TBA'; - } - ?>
TOTAL PAYABLE (INCLUDING GST)currency($totals['total'], $currencyCode); +} +else { + echo $currencySymbol.'TBA'; +} +?>
diff --git a/views/users/login.ctp b/views/users/login.ctp index e572ba78..452154a3 100755 --- a/views/users/login.ctp +++ b/views/users/login.ctp @@ -1,3 +1,6 @@ +
+
+Login check('Message.auth')) $session->flash('auth'); echo $form->create('User', array('action' => 'login')); @@ -6,3 +9,5 @@ echo $form->input('password'); echo $form->input('remember_me', array('label' => 'Keep me logged in on this Computer', 'type' => 'checkbox')); echo $form->end('Login'); ?> +
+
diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index e97dad10..c1573586 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -1646,4 +1646,10 @@ div.warning p { #extraModels li { font-size: 1.5em; -} \ No newline at end of file +} + + +tr.no_items { + font-size: 2em; + padding: 0.5em; +} diff --git a/webroot/js/document_add_edit.js b/webroot/js/document_add_edit.js index e6f57e4c..b94f0f92 100644 --- a/webroot/js/document_add_edit.js +++ b/webroot/js/document_add_edit.js @@ -2,7 +2,6 @@ * Could (should) tidy this up to move the Quote/Invoice etc Specific * functionality into seperate files. * - * Will do this at some point. Today I just need to hammer this out. * * Karl - 20/5/2011 */ @@ -10,631 +9,631 @@ $(function() { - // var config defined in global.js - loadLineItems(); - var docID = $('#documentID').html(); + // var config defined in global.js + loadLineItems(); + var docID = $('#documentID').html(); - $("#flashMessage").hide(); + $("#flashMessage").hide(); - $("#lineItemDetails").hide(); + $("#lineItemDetails").hide(); - $( "#addLineItemModal" ).dialog({ - autoOpen: false, - height: 900, - width: 600, - modal: true, - buttons: { - "Add Line Item": function() { - - $('#LineItemDescription').ckeditor(function() { - this.updateElement(); - }); + $( "#addLineItemModal" ).dialog({ + autoOpen: false, + height: 900, + width: 600, + modal: true, + buttons: { + "Add Line Item": function() { + + $('#LineItemDescription').ckeditor(function() { + this.updateElement(); + }); - var thisLineItemInputs = $('#LineItemAddForm').find('input,select,textarea'); + var thisLineItemInputs = $('#LineItemAddForm').find('input,select,textarea'); - $.post('/line_items/ajax_add', thisLineItemInputs, function(data) { - - if(data == 'SUCCESS') { - loadLineItems(); - $( "#addLineItemModal" ).dialog('close'); - } - else { - alert("Line Item could not be saved") - $('#LineItemDescription').ckeditor(config); - } + $.post('/line_items/ajax_add', thisLineItemInputs, function(data) { - }); + if(data == 'SUCCESS') { + loadLineItems(); + $( "#addLineItemModal" ).dialog('close'); + } + else { + alert("Line Item could not be saved") + $('#LineItemDescription').ckeditor(config); + } - }, - Cancel: function() { - $( this ).dialog( "close" ); - } - }, - close: function() { - loadLineItems(); - } - - }); + }); - $( "#editLineItemModal" ).dialog({ - autoOpen: false, - height: 900, - width: 600, - modal: true, - buttons: { - "Edit Line Item": function() { - $('#LineItemDescription').ckeditor(function() { - this.updateElement(); - }); - - var thisLineItemInputs = $('#LineItemEditForm').find('input,select,textarea'); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + loadLineItems(); + } - $.post('/line_items/ajax_edit', thisLineItemInputs, function(data) { - if(data == 'SUCCESS') { - $( "#editLineItemModal" ).dialog('close'); - } - else { - alert("Line Item could not be saved") - $('#LineItemDescription').ckeditor(config); - } - }); + }); - }, - Cancel: function() { - $( "#editLineItemModal" ).dialog('close'); - - } - }, - close: function() { - loadLineItems(); + $( "#editLineItemModal" ).dialog({ + autoOpen: false, + height: 900, + width: 600, + modal: true, + buttons: { + "Edit Line Item": function() { + $('#LineItemDescription').ckeditor(function() { + this.updateElement(); + }); - } + var thisLineItemInputs = $('#LineItemEditForm').find('input,select,textarea'); + + $.post('/line_items/ajax_edit', thisLineItemInputs, function(data) { + if(data == 'SUCCESS') { + $( "#editLineItemModal" ).dialog('close'); + } + else { + alert("Line Item could not be saved") + $('#LineItemDescription').ckeditor(config); + } + }); + + }, + Cancel: function() { + $( "#editLineItemModal" ).dialog('close'); + + } + }, + close: function() { + loadLineItems(); + + } + }); + + + $( "#QuoteDetails" ).dialog({ + autoOpen: false, + height: 900, + width: 600, + modal: true, + buttons: { + "Edit Quote Details": function() { + + + $('#QuoteCommercialComments').ckeditor(function() { + this.updateElement(); + this.destroy(); + }); + + + var quoteInputs = $('#QuoteEditForm').find('input,select,textarea'); + + $.post('/quotes/ajax_edit', quoteInputs, function(data) { + $( "#QuoteDetails" ).dialog('close'); + }); + + }, + Cancel: function() { + $( this ).dialog( "close" ); + + } + }, + close: function() { + loadLineItems(); + } + }); + + + + $( "#addJobConfirmation" ).dialog({ + autoOpen: false, + height: 400, + width: 400, + modal: true, + buttons: { + "Create New Job and Order Acknowledgement": function() { + + var documentID = $("#documentID").html(); + + //window.location.href = "/documents/convert_to_oa/"+documentID; + //var newOAform = $('#DocumentConvertToOaForm').find('input'); + var newOAform = $('#DocumentConvertToOaForm'); + newOAform.submit(); + + + + /*$.post('/documents/convert_to_oa', newOAform, function(data) { + if(data =='SUCCESS') { + $("#flashMessage").html("Invoice Saved Successfully"); + } + else { + $("#flashMessage").html("Unable to Save Invoice"); + } + + $("#flashMessage").show(); + + + loadLineItems(); + }); + */ + + + }, + Cancel: function() { + $( this ).dialog( "close" ); + + } + }, + close: function() { + } + }); + + + $("#pageContentFactory").hide(); + + + //Add a new Page Element. + $("#addPage").button().click(function(event) { + event.preventDefault(); + + newPage(false); + return false; + }); + + + //Open the LineItem dialog + $(".addLineItem").button().click(function() { + + + + $('#LineItemDescription').ckeditor(function() { + this.destroy(); }); - $( "#QuoteDetails" ).dialog({ - autoOpen: false, - height: 900, - width: 600, - modal: true, - buttons: { - "Edit Quote Details": function() { + $("#editLineItemModal").empty(); - $('#QuoteCommercialComments').ckeditor(function() { - this.updateElement(); - this.destroy(); - }); + + var nextItemNo = $(".lineItem").length; + nextItemNo++; + + $.get('/line_items/add/'+docID, function(data) { + $("#addLineItemModal").html(data); - var quoteInputs = $('#QuoteEditForm').find('input,select,textarea'); + $("#LineItemItemNumber").val(nextItemNo); //Auto fill in the next Item No - $.post('/quotes/ajax_edit', quoteInputs, function(data) { - $( "#QuoteDetails" ).dialog('close'); - }); - }, - Cancel: function() { - $( this ).dialog( "close" ); + $("#productDetails").hide(); + + $('#LineItemDescription').ckeditor(config); + + showHideTextPrices(); + + $( "#addLineItemModal" ).dialog('open'); - } - }, - close: function() { - loadLineItems(); - } }); + return false; + }); - $( "#addJobConfirmation" ).dialog({ - autoOpen: false, - height: 400, - width: 400, - modal: true, - buttons: { - "Create New Job and Order Acknowledgement": function() { - - var documentID = $("#documentID").html(); - - //window.location.href = "/documents/convert_to_oa/"+documentID; - //var newOAform = $('#DocumentConvertToOaForm').find('input'); - var newOAform = $('#DocumentConvertToOaForm'); - newOAform.submit(); + $(".editLineItem").live('click', function() { - - /*$.post('/documents/convert_to_oa', newOAform, function(data) { - if(data =='SUCCESS') { - $("#flashMessage").html("Invoice Saved Successfully"); - } - else { - $("#flashMessage").html("Unable to Save Invoice"); - } - - $("#flashMessage").show(); - - - loadLineItems(); - }); - */ - - - }, - Cancel: function() { - $( this ).dialog( "close" ); - - } - }, - close: function() { - } + $('#LineItemDescription').ckeditor(function() { + this.destroy(); }); - - $("#pageContentFactory").hide(); + $("#addLineItemModal").empty(); - - //Add a new Page Element. - $("#addPage").button().click(function(event) { - event.preventDefault(); + var thisLineItemID = $(this).parent('td').attr('id'); + $.get('/line_items/edit/'+thisLineItemID, function(data) { + $("#editLineItemModal").html(data); + $("#productDetails").hide(); + $('#LineItemDescription').ckeditor(config); + showHideTextPrices(); + $( "#editLineItemModal" ).dialog('open'); - newPage(false); - return false; + }); + }); + + + $("#principleSelect").live('change',function() { + + var principleID = getSelectedID('#principleSelect'); + + $("#productDetails").hide(); + + $.get('/documents/getProducts/'+principleID, function(data) { + $('#productsDiv').html(data); + }); + }); + + + $("#productSelect").live('change',function() { + + var productID = getSelectedID('#productSelect'); + + $.get('/documents/getProductDetails/'+productID, function(data) { + + $("#lineItemDetails").show(); + $("#LineItemProductId").val(data.id); + $("#LineItemTitle").val(data.title); + $("#LineItemDescription").val(data.description); + + + }, "json"); + }); + + + // Initialize the editor. + // Callback function can be passed and executed after full instance creation. + $('.page').ckeditor(config); + + + $("#LineItemHasTextPrices").live('change', function() { + showHideTextPrices(); + }); + + + //Remove this Page + $(".removePage").live('click',function() { + + $('.page').ckeditor(function() { + this.destroy(); }); + $(this).parents(".docPage").remove(); - //Open the LineItem dialog - $(".addLineItem").button().click(function() { - - - - $('#LineItemDescription').ckeditor(function() { - this.destroy(); - }); - - - $("#editLineItemModal").empty(); - - - - var nextItemNo = $(".lineItem").length; - nextItemNo++; - - $.get('/line_items/add/'+docID, function(data) { - $("#addLineItemModal").html(data); - - - $("#LineItemItemNumber").val(nextItemNo); //Auto fill in the next Item No - - - $("#productDetails").hide(); - - $('#LineItemDescription').ckeditor(config); - - showHideTextPrices(); - - $( "#addLineItemModal" ).dialog('open'); - - }); - - return false; - }); - - - $(".editLineItem").live('click', function() { - - - $('#LineItemDescription').ckeditor(function() { - this.destroy(); - }); - - $("#addLineItemModal").empty(); - - var thisLineItemID = $(this).parent('td').attr('id'); - $.get('/line_items/edit/'+thisLineItemID, function(data) { - $("#editLineItemModal").html(data); - $("#productDetails").hide(); - $('#LineItemDescription').ckeditor(config); - showHideTextPrices(); - $( "#editLineItemModal" ).dialog('open'); - - }); - }); - - - $("#principleSelect").live('change',function() { - - var principleID = getSelectedID('#principleSelect'); - - $("#productDetails").hide(); - - $.get('/documents/getProducts/'+principleID, function(data) { - $('#productsDiv').html(data); - }); - }); - - - $("#productSelect").live('change',function() { - - var productID = getSelectedID('#productSelect'); - - $.get('/documents/getProductDetails/'+productID, function(data) { - - $("#lineItemDetails").show(); - $("#LineItemProductId").val(data.id); - $("#LineItemTitle").val(data.title); - $("#LineItemDescription").val(data.description); - - - }, "json"); - }); - - - // Initialize the editor. - // Callback function can be passed and executed after full instance creation. $('.page').ckeditor(config); - - $("#LineItemHasTextPrices").live('change', function() { - showHideTextPrices(); + }); + + + $("#savePages").click(function() { + savePages(); + + }); + + + $(".quickpricing").live('change', function() { + calculateQuickPrices(); + }); + + + $('.removeLineItem').live('click', function() { + var thisLineItemID = $(this).parent('td').attr('id'); + $.post('/line_items/ajax_delete/'+thisLineItemID, function(data) { + loadLineItems(); + }); + }); + + + $("#editQuoteDetails").click(function() { + var quoteID = $("#quoteID").html(); + + $('#QuoteCommercialComments').ckeditor(function() { + this.destroy(); }); - - //Remove this Page - $(".removePage").live('click',function() { + $.get('/quotes/edit/'+quoteID, function(data) { - $('.page').ckeditor(function() { - this.destroy(); - }); - $(this).parents(".docPage").remove(); - $('.page').ckeditor(config); + $("#QuoteDetails").html(data); + $('#QuoteCommercialComments').ckeditor(config); + + $("#QuoteDetails").dialog('open'); }); + }); - $("#savePages").click(function() { - savePages(); + $("#generateFirstPage").click(function() { - }); - - - $(".quickpricing").live('change', function() { - calculateQuickPrices(); - }); - - - $('.removeLineItem').live('click', function() { - var thisLineItemID = $(this).parent('td').attr('id'); - $.post('/line_items/ajax_delete/'+thisLineItemID, function(data) { - loadLineItems(); - }); - }); - - - $("#editQuoteDetails").click(function() { - var quoteID = $("#quoteID").html(); - - $('#QuoteCommercialComments').ckeditor(function() { - this.destroy(); - }); - - $.get('/quotes/edit/'+quoteID, function(data) { - - - - $("#QuoteDetails").html(data); - - $('#QuoteCommercialComments').ckeditor(config); - - $("#QuoteDetails").dialog('open'); - }); - }); - - - $("#generateFirstPage").click(function() { - - if($(".firstPage").length == 0) { - newPage(true); - } - - $.get('/documents/generateFirstPage/'+docID, function(data) { - $(".firstPage").val(data); - savePages(); - }); - - - - }); - - - //Invoice View - $('#shippingDetails').ckeditor(config); - - $("#DocumentBillTo").ckeditor(config); - $("#DocumentShipTo").ckeditor(config); - - $("#saveInvoiceButton").click(function() { - - - - updateTextFields(); //Update the CKEditor instances. - - var invoiceDetails = $('#DocumentEditForm').find('input,select,textarea'); - - - - $.post('/documents/ajax_edit', invoiceDetails, function(data) { - if(data =='SUCCESS') { - $("#flashMessage").html("Invoice Saved Successfully"); - } - else { - $("#flashMessage").html("Unable to Save Invoice"); - } - - $("#flashMessage").show(); - - - loadLineItems(); - }); - - }); - //OA View. - $("#saveOAButton").click(function() { - - - updateTextFields(); //Update the CKEditor instances. - - var invoiceDetails = $('#DocumentEditForm').find('input,select,textarea'); - - - - $.post('/documents/ajax_edit', invoiceDetails, function(data) { - if(data =='SUCCESS') { - $("#flashMessage").html("Order Acknowledgement Saved Successfully"); - } - else { - $("#flashMessage").html("Unable to Save Order Acknowledgement"); - } - - $("#flashMessage").show(); - - - loadLineItems(); - }); + if($(".firstPage").length == 0) { + newPage(true); + } + $.get('/documents/generateFirstPage/'+docID, function(data) { + $(".firstPage").val(data); + savePages(); }); - $("#createJobAndOA").click(function() { - $("#addJobConfirmation").dialog('open'); + }); + + + //Invoice View + $('#shippingDetails').ckeditor(config); + + $("#DocumentBillTo").ckeditor(config); + $("#DocumentShipTo").ckeditor(config); + + $("#saveInvoiceButton").click(function() { + + + + updateTextFields(); //Update the CKEditor instances. + + var invoiceDetails = $('#DocumentEditForm').find('input,select,textarea'); + + + + $.post('/documents/ajax_edit', invoiceDetails, function(data) { + if(data =='SUCCESS') { + $("#flashMessage").html("Invoice Saved Successfully"); + } + else { + $("#flashMessage").html("Unable to Save Invoice"); + } + + $("#flashMessage").show(); + + + loadLineItems(); }); + }); + //OA View. + $("#saveOAButton").click(function() { + + + updateTextFields(); //Update the CKEditor instances. + + var invoiceDetails = $('#DocumentEditForm').find('input,select,textarea'); + + + + $.post('/documents/ajax_edit', invoiceDetails, function(data) { + if(data =='SUCCESS') { + $("#flashMessage").html("Order Acknowledgement Saved Successfully"); + } + else { + $("#flashMessage").html("Unable to Save Order Acknowledgement"); + } + + $("#flashMessage").show(); + + + loadLineItems(); + }); + + }); + + + + $("#createJobAndOA").click(function() { + $("#addJobConfirmation").dialog('open'); + }); + }); $('.generateCommercialComments').live('click', function(event) { - event.preventDefault(); - - - - var deliveryTime = $("#QuoteDeliveryTime").val(); - var deliveryTF = $("#QuoteDeliveryTimeFrame").val(); - var paymentTerms = $("#QuotePaymentTerms").val(); - var daysValid = $("#QuoteDaysValid").val(); - var deliveryPoint = $("#QuoteDeliveryPoint").val(); - var exchangeRate = $("#QuoteExchangeRate").val(); - var customsDuty = $("#QuoteCustomsDuty").val(); + event.preventDefault(); - deliveryTime = deliveryTime.toUpperCase(); - paymentTerms = paymentTerms.toUpperCase(); - deliveryPoint = deliveryPoint.toUpperCase(); - - var commComments = $("#commCommentsInitialString").clone(); - var commList = commComments.find('ol'); + var deliveryTime = $("#QuoteDeliveryTime").val(); + var deliveryTF = $("#QuoteDeliveryTimeFrame").val(); + var paymentTerms = $("#QuotePaymentTerms").val(); + var daysValid = $("#QuoteDaysValid").val(); + var deliveryPoint = $("#QuoteDeliveryPoint").val(); + var exchangeRate = $("#QuoteExchangeRate").val(); + var customsDuty = $("#QuoteCustomsDuty").val(); + + + deliveryTime = deliveryTime.toUpperCase(); + paymentTerms = paymentTerms.toUpperCase(); + deliveryPoint = deliveryPoint.toUpperCase(); + + var commComments = $("#commCommentsInitialString").clone(); + + var commList = commComments.find('ol'); + + commList.append('
  • DELIVERY IS ESTIMATED AT '+deliveryTime+ ' '+deliveryTF+ ' FROM RECEIPT OF YOUR TECHNICALLY AND COMMERCIALLY CLEAR ORDER'); + commList.append('
  • PAYMENT TERMS: '+paymentTerms+'
  • '); + commList.append('
  • QUOTATION IS VALID FOR '+daysValid+' DAYS
  • '); + commList.append('
  • ALL PRICES ARE '+deliveryPoint+'
  • '); + commList.append('
  • EXCHANGE RATE: '+exchangeRate+'
  • '); + commList.append('
  • CUSTOMS DUTY INCLUDED AT: '+customsDuty+'
  • '); + commList.append('
  • GST 10% EXTRA
  • '); + commList.append('
  • WHEN PAYMENTS ARE MADE INTO OUR BANK ACCOUNT, BANK CHARGES ARE YOUR RESPONSIBILITY
  • '); + $('#QuoteCommercialComments').val(commComments.html()); + - commList.append('
  • DELIVERY IS ESTIMATED AT '+deliveryTime+ ' '+deliveryTF+ ' FROM RECEIPT OF YOUR TECHNICALLY AND COMMERCIALLY CLEAR ORDER'); - commList.append('
  • PAYMENT TERMS: '+paymentTerms+'
  • '); - commList.append('
  • QUOTATION IS VALID FOR '+daysValid+' DAYS
  • '); - commList.append('
  • ALL PRICES ARE '+deliveryPoint+'
  • '); - commList.append('
  • EXCHANGE RATE: '+exchangeRate+'
  • '); - commList.append('
  • CUSTOMS DUTY INCLUDED AT: '+customsDuty+'
  • '); - commList.append('
  • GST 10% EXTRA
  • '); - commList.append('
  • WHEN PAYMENTS ARE MADE INTO OUR BANK ACCOUNT, BANK CHARGES ARE YOUR RESPONSIBILITY
  • '); - $('#QuoteCommercialComments').val(commComments.html()); - - }); function showHideTextPrices() { - if( $('#LineItemHasTextPrices').val() == 1) { - $("#noCosting").hide(); - $("#noCosting").find('input').val(''); - $("#textPrices").show(); - } - else { - $("#noCosting").show(); - $("#textPrices").hide(); - } + if( $('#LineItemHasTextPrices').val() == 1) { + $("#noCosting").hide(); + $("#noCosting").find('input').val(''); + $("#textPrices").show(); + } + else { + $("#noCosting").show(); + $("#textPrices").hide(); + } } function updateTextFields() { - $('#shippingDetails').ckeditor(function() { - this.updateElement(); - }); + $('#shippingDetails').ckeditor(function() { + this.updateElement(); + }); - $("#DocumentBillTo").ckeditor(function() { - this.updateElement(); - }); - $("#DocumentShipTo").ckeditor(function() { - this.updateElement(); - }); + $("#DocumentBillTo").ckeditor(function() { + this.updateElement(); + }); + $("#DocumentShipTo").ckeditor(function() { + this.updateElement(); + }); } function newPage(firstPage) { - - $('.page').ckeditor(function() { - this.destroy(); - }); + + $('.page').ckeditor(function() { + this.destroy(); + }); - var newPage = $('#pageContentFactory').clone(); - newPage.removeAttr('id'); - newPage.show(); + var newPage = $('#pageContentFactory').clone(); + newPage.removeAttr('id'); + newPage.show(); - - var pageCount = $('.docPage').length; - //alert(pageCount); + var pageCount = $('.docPage').length; - pageCount++; - var model = 'DocPage'; - var field = 'content'; - var ID = getCakeID(model,pageCount, field); - var name = getCakeName(model, pageCount, field); - - newPage.find('label').attr('for', ID); - - newPage.find('textarea').attr('id', ID).attr('name', name); - newPage.addClass('docPage'); + //alert(pageCount); + + pageCount++; + var model = 'DocPage'; + var field = 'content'; + var ID = getCakeID(model,pageCount, field); + var name = getCakeName(model, pageCount, field); + + newPage.find('label').attr('for', ID); + + newPage.find('textarea').attr('id', ID).attr('name', name); + newPage.addClass('docPage'); - if(firstPage == true) { - newPage.find('textarea').addClass('firstPage'); - } + if(firstPage == true) { + newPage.find('textarea').addClass('firstPage'); + } - var hiddenName = getCakeName(model, pageCount, 'page_number'); + var hiddenName = getCakeName(model, pageCount, 'page_number'); - newPage.append(''); - $('.pages').append(newPage); - - $('.page').ckeditor(config); + newPage.append(''); + $('.pages').append(newPage); + + $('.page').ckeditor(config); } function savePages() { - var docPages = $('#DocumentEditForm').find('input,select,textarea'); + var docPages = $('#DocumentEditForm').find('input,select,textarea'); - $('.page').ckeditor(function() { - this.updateElement(); - }); + $('.page').ckeditor(function() { + this.updateElement(); + }); - $.post('/documents/ajax_edit', docPages, function(data) { - if(data =='SUCCESS') { - $("#flashMessage").html("Pages Saved Successfully"); - } - else { - $("#flashMessage").html("Unable to Save Pages"); - } + $.post('/documents/ajax_edit', docPages, function(data) { + if(data =='SUCCESS') { + $("#flashMessage").html("Pages Saved Successfully"); + } + else { + $("#flashMessage").html("Unable to Save Pages"); + } - $("#flashMessage").show(); + $("#flashMessage").show(); - loadLineItems(); - }); + loadLineItems(); + }); } function loadLineItems() { - var documentID = $("#documentID").html(); + var documentID = $("#documentID").html(); - /*$.get('/line_items/getTable/'+documentID, function(data) { - $("#lineItems").html(data); + /*$.get('/line_items/getTable/'+documentID, function(data) { + $("#lineItems").html(data); });*/ - - $.ajax({ - url: '/line_items/getTable/'+documentID, - cache: false, - success: function(data) { - $("#lineItems").html(data); - } - }); - + + $.ajax({ + url: '/line_items/getTable/'+documentID, + cache: false, + success: function(data) { + $("#lineItems").html(data); + } + }); + } function calculateQuickPrices() { - var quantity = $('#LineItemQuantity').val(); + var quantity = $('#LineItemQuantity').val(); - var gross_unit_price = $("#LineItemGrossUnitPrice").val(); - var net_unit_price = $("#LineItemNetUnitPrice").val(); - var discount_percent = $("#LineItemDiscountPercent").val(); - var discount_amount_unit = $("#LineItemDiscountAmountUnit").val(); - var discount_amount_total = $("#LineItemDiscountAmountTotal").val(); - var gross_price = $("#LineItemGrossPrice").val(); - var net_price = $("#LineItemNetPrice").val(); + var gross_unit_price = $("#LineItemGrossUnitPrice").val(); + var net_unit_price = $("#LineItemNetUnitPrice").val(); + var discount_percent = $("#LineItemDiscountPercent").val(); + var discount_amount_unit = $("#LineItemDiscountAmountUnit").val(); + var discount_amount_total = $("#LineItemDiscountAmountTotal").val(); + var gross_price = $("#LineItemGrossPrice").val(); + var net_price = $("#LineItemNetPrice").val(); - gross_price = quantity * gross_unit_price; - $("#LineItemGrossPrice").val(gross_price); + gross_price = quantity * gross_unit_price; + $("#LineItemGrossPrice").val(gross_price); - discount_amount_unit = (discount_percent/100) * gross_unit_price; - discount_amount_unit = discount_amount_unit.toFixed(2); + discount_amount_unit = (discount_percent/100) * gross_unit_price; + discount_amount_unit = discount_amount_unit.toFixed(2); - discount_amount_total = (discount_percent/100) * gross_price; - discount_amount_total = discount_amount_total.toFixed(2); - $("#LineItemDiscountAmountTotal").val(discount_amount_total); + discount_amount_total = (discount_percent/100) * gross_price; + discount_amount_total = discount_amount_total.toFixed(2); + $("#LineItemDiscountAmountTotal").val(discount_amount_total); - net_price = gross_price - discount_amount_total; - $("#LineItemNetPrice").val(net_price); + net_price = gross_price - discount_amount_total; + $("#LineItemNetPrice").val(net_price); + + + $("#LineItemDiscountAmountUnit").val(discount_amount_unit); + net_unit_price = gross_unit_price - discount_amount_unit; + $("#LineItemNetUnitPrice").val(net_unit_price); - $("#LineItemDiscountAmountUnit").val(discount_amount_unit); - net_unit_price = gross_unit_price - discount_amount_unit; - $("#LineItemNetUnitPrice").val(net_unit_price); - - } function calcNetPrice() { - var discountPercent = $("#discountPercent").val(); - var unitPrice = $('#unitPrice').val(); + var discountPercent = $("#discountPercent").val(); + var unitPrice = $('#unitPrice').val(); - var quantity = $('#LineItemQuantity').val(); + var quantity = $('#LineItemQuantity').val(); - var grossSellPrice = quantity * unitPrice; + var grossSellPrice = quantity * unitPrice; - //Calculate the Sale Discount amount. - var UnitDiscountAmount = (discountPercent/100) * unitPrice; + //Calculate the Sale Discount amount. + var UnitDiscountAmount = (discountPercent/100) * unitPrice; - var TotalDiscountAmount = (discountPercent/100) * grossSellPrice; - UnitDiscountAmount = UnitDiscountAmount.toFixed(2); - TotalDiscountAmount = TotalDiscountAmount.toFixed(2); + var TotalDiscountAmount = (discountPercent/100) * grossSellPrice; + UnitDiscountAmount = UnitDiscountAmount.toFixed(2); + TotalDiscountAmount = TotalDiscountAmount.toFixed(2); - $('#total_discountAmount').val(TotalDiscountAmount); - $('#discountAmountEach').val(UnitDiscountAmount); - $('#net_price_each').val(unitPrice - UnitDiscountAmount); + $('#total_discountAmount').val(TotalDiscountAmount); + $('#discountAmountEach').val(UnitDiscountAmount); + $('#net_price_each').val(unitPrice - UnitDiscountAmount); - $('#grossPrice').val(grossSellPrice); + $('#grossPrice').val(grossSellPrice); - var netPrice = grossSellPrice - TotalDiscountAmount; - $('#netPrice').val(netPrice); + var netPrice = grossSellPrice - TotalDiscountAmount; + $('#netPrice').val(netPrice); } function checkNaN(value) { - if( isNaN(value) == true) { - return 0; - } - else { - return value; - } + if( isNaN(value) == true) { + return 0; + } + else { + return value; + } - -} \ No newline at end of file + +} From 488e324be47f9f031aa0a3101c7efee661604538 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Mon, 14 Nov 2011 13:32:48 +1100 Subject: [PATCH 2/7] Revert "Changed wording in admin page" This reverts commit 9778271c5d29c9c5b6e47e2b565fd64fdd163a87. --- views/pages/admin.ctp | 5 ++--- webroot/css/quotenik.css | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/views/pages/admin.ctp b/views/pages/admin.ctp index 11bac44c..61af84ba 100644 --- a/views/pages/admin.ctp +++ b/views/pages/admin.ctp @@ -1,8 +1,7 @@

    WARNING: Deleting any records from these tables can have serious implications for data integrity.

    -

    Records in other tables could potentially end up referencing non-existing records.

    -

    eg. If currency id 2 were deleted, all other records referencing AUD would lose that reference.

    -

    Be careful!

    +

    ie.Records in other tables could potentially end up referencing non-existing records. if currency id 2 were deleted, all records referencing AUD will be break.

    +

    Tread carefully.