View | Details | Raw Unified | Return to bug 11062
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2622-2628 sub AddInvoice { Link Here
2622
    return unless(%invoice and $invoice{invoicenumber});
2622
    return unless(%invoice and $invoice{invoicenumber});
2623
2623
2624
    my @columns = qw(invoicenumber booksellerid shipmentdate billingdate
2624
    my @columns = qw(invoicenumber booksellerid shipmentdate billingdate
2625
        closedate shipping shipmentcost_budgetid);
2625
        closedate shipping shipping_tax_rate shipmentcost_budgetid);
2626
2626
2627
    my @set_strs;
2627
    my @set_strs;
2628
    my @set_args;
2628
    my @set_args;
(-)a/C4/Bookseller.pm (-3 / +6 lines)
Lines 139-147 sub AddBookseller { Link Here
139
                postal,    phone,         accountnumber,fax,      url,
139
                postal,    phone,         accountnumber,fax,      url,
140
                active,    listprice,     invoiceprice, gstreg,
140
                active,    listprice,     invoiceprice, gstreg,
141
                listincgst,invoiceincgst, tax_rate,      discount, notes,
141
                listincgst,invoiceincgst, tax_rate,      discount, notes,
142
                deliverytime
142
                deliverytime, shipping_tax_rate, shippingincgst
143
            )
143
            )
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
145
      ;
145
      ;
146
    my $sth = $dbh->prepare($query);
146
    my $sth = $dbh->prepare($query);
147
    $sth->execute(
147
    $sth->execute(
Lines 155-160 sub AddBookseller { Link Here
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
156
        $data->{'tax_rate'},      $data->{'discount'},
156
        $data->{'tax_rate'},      $data->{'discount'},
157
        $data->{notes},          $data->{deliverytime},
157
        $data->{notes},          $data->{deliverytime},
158
        $data->{shipping_tax_rate}, $data->{shippingincgst},
158
    );
159
    );
159
160
160
    # return the id of this new supplier
161
    # return the id of this new supplier
Lines 196-202 sub ModBookseller { Link Here
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
197
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
197
            active=?,listprice=?, invoiceprice=?,
198
            active=?,listprice=?, invoiceprice=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
199
            gstreg=?,listincgst=?,invoiceincgst=?,
199
            discount=?,notes=?,tax_rate=?,deliverytime=?
200
            discount=?,notes=?,tax_rate=?,deliverytime=?,
201
            shipping_tax_rate = ?, shippingincgst = ?
200
        WHERE id=?';
202
        WHERE id=?';
201
    my $sth = $dbh->prepare($query);
203
    my $sth = $dbh->prepare($query);
202
    my $cnt = $sth->execute(
204
    my $cnt = $sth->execute(
Lines 210-215 sub ModBookseller { Link Here
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
212
        $data->{'listincgst'},   $data->{'invoiceincgst'},
211
        $data->{'discount'},     $data->{'notes'},
213
        $data->{'discount'},     $data->{'notes'},
212
        $data->{'tax_rate'},      $data->{deliverytime},
214
        $data->{'tax_rate'},      $data->{deliverytime},
215
        $data->{shipping_tax_rate}, $data->{shippingincgst},
213
        $data->{'id'}
216
        $data->{'id'}
214
    );
217
    );
215
    $contacts ||= $data->{'contacts'};
218
    $contacts ||= $data->{'contacts'};
(-)a/acqui/parcels.pl (-1 / +9 lines)
Lines 107-118 if($shipmentdate) { Link Here
107
    $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
107
    $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
108
}
108
}
109
109
110
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
111
110
if ( $op and $op eq 'new' ) {
112
if ( $op and $op eq 'new' ) {
111
    if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) {
113
    if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) {
112
        my @invoices = GetInvoices(
114
        my @invoices = GetInvoices(
113
            supplierid    => $booksellerid,
115
            supplierid    => $booksellerid,
114
            invoicenumber => $invoicenumber,
116
            invoicenumber => $invoicenumber,
115
        );
117
        );
118
116
        if ( scalar @invoices > 0 ) {
119
        if ( scalar @invoices > 0 ) {
117
            $template->{'VARS'}->{'duplicate_invoices'} = \@invoices;
120
            $template->{'VARS'}->{'duplicate_invoices'} = \@invoices;
118
            $template->{'VARS'}->{'invoicenumber'}      = $invoicenumber;
121
            $template->{'VARS'}->{'invoicenumber'}      = $invoicenumber;
Lines 125-135 if ( $op and $op eq 'new' ) { Link Here
125
    $op = 'confirm' unless $template->{'VARS'}->{'duplicate_invoices'};
128
    $op = 'confirm' unless $template->{'VARS'}->{'duplicate_invoices'};
126
}
129
}
127
if ($op and $op eq 'confirm') {
130
if ($op and $op eq 'confirm') {
131
    my $shipping_tax_rate = $bookseller->{shipping_tax_rate};
132
    unless ( $bookseller->{shippingincgst} ) {
133
        $shipping = $shipping  * ( 1 + $shipping_tax_rate );
134
    }
135
128
    my $invoiceid = AddInvoice(
136
    my $invoiceid = AddInvoice(
129
        invoicenumber => $invoicenumber,
137
        invoicenumber => $invoicenumber,
130
        booksellerid => $booksellerid,
138
        booksellerid => $booksellerid,
131
        shipmentdate => $shipmentdate,
139
        shipmentdate => $shipmentdate,
132
        shipping => $shipping,
140
        shipping => $shipping,
141
        shipping_tax_rate => $shipping_tax_rate,
133
        shipmentcost_budgetid => $shipmentcost_budgetid,
142
        shipmentcost_budgetid => $shipmentcost_budgetid,
134
    );
143
    );
135
    if(defined $invoiceid) {
144
    if(defined $invoiceid) {
Lines 141-147 if ($op and $op eq 'confirm') { Link Here
141
    }
150
    }
142
}
151
}
143
152
144
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
145
my @parcels = GetInvoices(
153
my @parcels = GetInvoices(
146
    supplierid => $booksellerid,
154
    supplierid => $booksellerid,
147
    invoicenumber => $code,
155
    invoicenumber => $code,
(-)a/acqui/supplier.pl (+2 lines)
Lines 83-88 if ( $op eq 'display' ) { Link Here
83
    $template->param(
83
    $template->param(
84
        active        => $supplier->{'active'},
84
        active        => $supplier->{'active'},
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
86
        shipping_tax_rate => $supplier->{'shipping_tax_rate'} + 0.0,
86
        invoiceprice  => $supplier->{'invoiceprice'},
87
        invoiceprice  => $supplier->{'invoiceprice'},
87
        listprice     => $supplier->{'listprice'},
88
        listprice     => $supplier->{'listprice'},
88
        basketcount   => $supplier->{'basketcount'},
89
        basketcount   => $supplier->{'basketcount'},
Lines 127-132 if ( $op eq 'display' ) { Link Here
127
        # set active ON by default for supplier add (id empty for add)
128
        # set active ON by default for supplier add (id empty for add)
128
        active       => $booksellerid ? $supplier->{'active'} : 1,
129
        active       => $booksellerid ? $supplier->{'active'} : 1,
129
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
130
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
131
        shipping_tax_rate => $supplier->{shipping_tax_rate} ? $supplier->{shipping_tax_rate}+0.0 : 0,
130
        gst_values    => \@gst_values,
132
        gst_values    => \@gst_values,
131
        loop_currency => $loop_currency,
133
        loop_currency => $loop_currency,
132
        enter         => 1,
134
        enter         => 1,
(-)a/acqui/updatesupplier.pl (+2 lines)
Lines 96-103 $data{'invoiceprice'}=$input->param('invoice_currency'); Link Here
96
$data{'gstreg'}=$input->param('gst');
96
$data{'gstreg'}=$input->param('gst');
97
$data{'listincgst'}=$input->param('list_gst');
97
$data{'listincgst'}=$input->param('list_gst');
98
$data{'invoiceincgst'}=$input->param('invoice_gst');
98
$data{'invoiceincgst'}=$input->param('invoice_gst');
99
$data{shippingincgst} = $input->param('shippingincgst');
99
#have to transform this into fraction so it's easier to use
100
#have to transform this into fraction so it's easier to use
100
$data{'tax_rate'} = $input->param('tax_rate');
101
$data{'tax_rate'} = $input->param('tax_rate');
102
$data{shipping_tax_rate} = $input->param('shipping_tax_rate');
101
$data{'discount'} = $input->param('discount');
103
$data{'discount'} = $input->param('discount');
102
$data{deliverytime} = $input->param('deliverytime');
104
$data{deliverytime} = $input->param('deliverytime');
103
$data{'active'}=$input->param('status');
105
$data{'active'}=$input->param('status');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-2 / +9 lines)
Lines 79-86 Link Here
79
            <li><label for="billingdate">Billing date:</label>
79
            <li><label for="billingdate">Billing date:</label>
80
                    <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li>
80
                    <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li>
81
81
82
            <li><label for="shipmentcost">Shipping cost:</label>
82
            <li><label for="shipping">shipping:</label>
83
                    <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" /></li>
83
                <input type="text" size="10" id="shipping" name="shipping" value="[% shipping %]" /></li>
84
85
            <li><label for="shipping_tax_rate">shipping tax rate:</label>
86
                <input type="text" size="10" id="shipping_tax_rate" name="shipping_tax_rate" value="[% shipping_tax_rate %]" /></li>
87
88
            <li><label for="shipping_tax_value">shipping_tax_value :</label>
89
                <input type="text" size="10" id="shipping_tax_value" name="shipping_tax_value" value="[% shipping_tax_value %]" /></li>
90
84
            <li><label for="shipment_budget_id">Fund:</label>
91
            <li><label for="shipment_budget_id">Fund:</label>
85
                    <select id="shipment_budget_id" name="shipment_budget_id">
92
                    <select id="shipment_budget_id" name="shipment_budget_id">
86
                        <option value="">No fund</option>
93
                        <option value="">No fund</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-5 / +38 lines)
Lines 236-241 function delete_contact(ev) { Link Here
236
                    [% END %]
236
                    [% END %]
237
                    </select>
237
                    </select>
238
            </li>
238
            </li>
239
            <li><label for="shipping_currency">Shipping prices are: </label>
240
                    <select name="shipping_currency" id="shipping_currency">
241
                    [% FOREACH loop_currenc IN loop_currency %]
242
                        [% IF ( loop_currenc.shippingprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option>
243
                        [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
244
                    [% END %]
245
                    </select>
246
            </li>
239
            </ol>
247
            </ol>
240
            <ol class="radio">
248
            <ol class="radio">
241
            <li><label for="gstyes" class="radio">Tax number registered:</label>
249
            <li><label for="gstyes" class="radio">Tax number registered:</label>
Lines 264-269 function delete_contact(ev) { Link Here
264
                    <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
272
                    <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
265
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
273
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
266
                [% END %]</li>
274
                [% END %]</li>
275
            <li><label for="shipping_gstyes" class="radio">Shipping prices:</label>
276
                [% IF ( shippingincgst ) %]
277
                    <label for="shipping_gstyes">Include tax</label> <input type="radio" id="shipping_gstyes" name="shippingincgst" value="1" checked="checked" />
278
                    <label for="shipping_gstno">Don't include tax</label> <input type="radio" id="shipping_gstno" name="shippingincgst" value="0" />
279
                [% ELSE %]
280
                    <label for="shipping_gstyes">Include tax</label> <input type="radio" id="shipping_gstyes" name="shippingincgst" value="1" />
281
                    <label for="shipping_gstno">Don't include tax</label> <input type="radio" id="shipping_gstno" name="shippingincgst" value="0" checked="checked" />
282
                [% END %]</li>
283
267
            </ol>
284
            </ol>
268
            [% IF gst_values %]
285
            [% IF gst_values %]
269
                <ol>
286
                <ol>
Lines 279-284 function delete_contact(ev) { Link Here
279
                    [% END %]
296
                    [% END %]
280
                    </select>
297
                    </select>
281
                  </li>
298
                  </li>
299
                  <li>
300
                    <label for="shipping_tax_rate">Shipping tax rate: </label>
301
                    <select name="shipping_tax_rate" id="shipping_tax_rate">
302
                    [% FOREACH gst IN gst_values %]
303
                      [% IF ( shipping_tax_rate == gst.option ) %]
304
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
305
                      [% ELSE %]
306
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
307
                      [% END %]
308
                    [% END %]
309
                    </select>
310
                  </li>
311
282
                </ol>
312
                </ol>
283
            [% ELSE %]
313
            [% ELSE %]
284
                <input type="hidden" name="tax_rate" value="0" />
314
                <input type="hidden" name="tax_rate" value="0" />
Lines 325-336 function delete_contact(ev) { Link Here
325
                        [% END %]</p>
355
                        [% END %]</p>
326
                <p><strong>List prices are: </strong>[% listprice %]</p>
356
                <p><strong>List prices are: </strong>[% listprice %]</p>
327
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
357
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
328
                [% IF ( tax_rate ) %]<p><strong>Tax number registered: </strong>
358
                [% IF tax_rate %]
359
                    <p><strong>Tax number registered: </strong>
329
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
360
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
330
                <p><strong>List item price includes tax: </strong>
361
                    <p><strong>List item price includes tax: </strong>
331
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
362
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
332
                <p><strong>Invoice item price includes tax: </strong>
363
                    <p><strong>Invoice item price includes tax: </strong>
333
                        [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>[% END %]
364
                        [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>
365
                    <p><strong>Shipping price includes tax: </strong>
366
                        [% IF ( shippingincgst ) %]Yes[% ELSE %]No[% END %]</p>
367
                [% END %]
334
                <p><strong>Discount: </strong>
368
                <p><strong>Discount: </strong>
335
                    [% discount | format("%.1f") %] %</p>
369
                    [% discount | format("%.1f") %] %</p>
336
                <p><strong>Tax rate: </strong>
370
                <p><strong>Tax rate: </strong>
337
- 

Return to bug 11062