Index: openacs-4/packages/invoices/tcl/offer-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-item-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/invoices/tcl/offer-item-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 +++ openacs-4/packages/invoices/tcl/offer-item-procs.tcl 11 Aug 2006 18:06:28 -0000 1.3 @@ -85,9 +85,11 @@ Edit Offer Item } { + set new_rev_id [db_nextval t_acs_object_id_seq] - if {[catch {content::revision::new \ + set new_rev_id [content::revision::new \ -item_id $offer_item_id \ + -revision_id $new_rev_id \ -content_type {iv_offer_item} \ -title $title \ -description $description \ @@ -103,28 +105,7 @@ [list sort_order $sort_order] \ [list vat $vat] \ [list parent_item_id $parent_item_id] ] - } - ] - } { - set new_rev_id [db_nextval t_acs_object_id_seq] - set new_rev_id [content::revision::new \ - -item_id $offer_item_id \ - -content_type {iv_offer_item} \ - -title $title \ - -description $description \ - -attributes [list \ - [list comment $comment] \ - [list item_nr $item_nr] \ - [list offer_id $offer_id] \ - [list item_units $item_units] \ - [list price_per_unit $price_per_unit] \ - [list rebate $rebate] \ - [list file_count $file_count] \ - [list page_count $page_count] \ - [list sort_order $sort_order] \ - [list vat $vat] \ - [list parent_item_id $parent_item_id] ] - ] - } + ] + ns_log Notice "Revision_id $new_rev_id" return $new_rev_id } Index: openacs-4/packages/invoices/tcl/offer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/invoices/tcl/offer-procs.tcl 29 Jun 2006 14:46:45 -0000 1.25 +++ openacs-4/packages/invoices/tcl/offer-procs.tcl 11 Aug 2006 18:06:28 -0000 1.26 @@ -301,9 +301,9 @@ set sum 0. db_multirow -local -extend {amount_sum amount_total category} items offer_items {} { if {$price_per_unit > 1} { - set item_units [format "%.1f" [expr $item_units * (1. + ($data(credit_percent) / 100.))]] + set item_units [expr $item_units * (1. + ($data(credit_percent) / 100.))] } else { - set item_units [format "%.1f" $item_units] + set item_units $item_units } set amount_sum [format "%.2f" [expr $item_units * $price_per_unit]] set amount_total [format "%.2f" [expr (1. - ($rebate / 100.)) * $amount_sum]] @@ -340,13 +340,15 @@ set data(am_name) $am_name set data(am_directphoneno) [ad_html_to_text -no_format $account_manager(directphoneno)] set am_directphoneno $data(am_directphoneno) + set am_directphoneno_int "+49 (0)[string trimleft $am_directphoneno 0]" } else { # Someone else is sending the offer. We need to mark this in the name contact::employee::get -employee_id [lindex $account_manager_ids 0] -array account_manager set account_manager_name "$account_manager(first_names) $account_manager(last_name)" set data(am_name) $account_manager_name set data(am_directphoneno) [ad_html_to_text -no_format $account_manager(directphoneno)] set am_directphoneno $data(am_directphoneno) + set am_directphoneno_int "+49 (0)[string trimleft $am_directphoneno 0]" set am_name "[_ contacts.pp] [contact::name -party_id $user_id]

$account_manager_name" } } else { Index: openacs-4/packages/invoices/www/invoice-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.tcl,v diff -u -N -r1.36 -r1.37 --- openacs-4/packages/invoices/www/invoice-ae.tcl 10 Aug 2006 07:34:59 -0000 1.36 +++ openacs-4/packages/invoices/www/invoice-ae.tcl 11 Aug 2006 18:06:28 -0000 1.37 @@ -345,10 +345,10 @@ set offer(credit_percent) 0. } if {$offer(price_per_unit) > 1.} { - set offer(credit) [format "%.1f" [expr $offer(item_units) * (($offer(credit_percent) + 100.) / 100.)]] + set offer(credit) [expr $offer(item_units) * (($offer(credit_percent) + 100.) / 100.)] } else { # do not add credit to items with price of 1 or less - set offer(credit) [format "%.1f" $offer(item_units)] + set offer(credit) $offer(item_units) } set offer(credit) [format "%.2f" [expr $offer(credit) * $offer(price_per_unit)]] set offer(credit) [format "%.2f" [expr (1. - ($offer(rebate) / 100.)) * $offer(credit)]] @@ -401,11 +401,13 @@ if {[empty_string_p $offer(credit_percent)]} { set offer(credit_percent) 0. } + + # Do not round the credit given. if {$offer(price_per_unit) > 1.} { - set offer(credit) [format "%.1f" [expr $offer(item_units) * (($offer(credit_percent) + 100.) / 100.)]] + set offer(credit) [expr $offer(item_units) * (($offer(credit_percent) + 100.) / 100.)] } else { # do not add credit to items with price of 1 or less - set offer(credit) [format "%.1f" $offer(item_units)] + set offer(credit) $offer(item_units) } set offer(credit) [format "%.2f" [expr $offer(credit) * $offer(price_per_unit)]] set offer(credit) [format "%.2f" [expr (1. - ($offer(rebate) / 100.)) * $offer(credit)]] Index: openacs-4/packages/invoices/www/offer-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.tcl,v diff -u -N -r1.34 -r1.35 --- openacs-4/packages/invoices/www/offer-ae.tcl 4 Aug 2006 15:36:05 -0000 1.34 +++ openacs-4/packages/invoices/www/offer-ae.tcl 11 Aug 2006 18:06:28 -0000 1.35 @@ -306,6 +306,7 @@ set item(item_units) 0 } + ns_log Notice "Units $item(item_units)" regsub {\[} $item(comment) {\(} item(comment) regsub {\[} $item(description) {\(} item(description) set item(price_per_unit) [format "%.2f" $item(price_per_unit)] @@ -315,7 +316,7 @@ set item(category) [lang::util::localize [category::get_name $item(category_id)]] # calculate credit from this item - set item_credit [format "%.1f" [expr $item(item_units) * (1+ ($_credit_percent / 100.))]] + set item_credit [expr $item(item_units) * (1+ ($_credit_percent / 100.))] set item_credit [format "%.2f" [expr $item_credit * $item(price_per_unit)]] set item_credit [format "%.2f" [expr (1. - ($item(rebate) / 100.)) * $item_credit]] set total_credit [expr $total_credit + $item_credit - $item(amount_total)] @@ -793,6 +794,7 @@ incr counter array set item $items($i) + ns_log Notice "$item(units)" if {[info exists offer_item_id($i)]} { # new revision of existing item set new_item_rev_id [iv::offer_item::edit \