CVars: Lieferadressen-CVars bei Ein-/Verkaufsbelegen benutzen können
[kivitendo-erp.git] / templates / webpages / io / ship_to.html
1 [% USE HTML %][% USE L %][% USE LxERP %][%- USE JavaScript -%]
2
3 <script type="text/javascript">
4   var addresses = [
5     { shiptoname:         "[% JavaScript.escape(vc_obj.name) %]",
6       shiptodepartment_1: "[% JavaScript.escape(vc_obj.department_1) %]",
7       shiptodepartment_2: "[% JavaScript.escape(vc_obj.department_2) %]",
8       shiptostreet:       "[% JavaScript.escape(vc_obj.street) %]",
9       shiptozipcode:      "[% JavaScript.escape(vc_obj.zipcode) %]",
10       shiptocity:         "[% JavaScript.escape(vc_obj.city) %]",
11       shiptocountry:      "[% JavaScript.escape(vc_obj.country) %]",
12       shiptogln:          "[% JavaScript.escape(vc_obj.gln) %]",
13       shiptocontact:      "[% JavaScript.escape(vc_obj.contact) %]",
14       shiptocp_gender:    "[% JavaScript.escape(vc_obj.cp_gender) %]",
15       shiptophone:        "[% JavaScript.escape(vc_obj.phone) %]",
16       shiptofax:          "[% JavaScript.escape(vc_obj.fax) %]",
17       shiptoemail:        "[% JavaScript.escape(vc_obj.email) %]"
18 [% FOREACH var = cvars %]
19       , "shiptocvar_[% JavaScript.escape(var.config.name) %]": ""
20 [% END %]
21     }
22
23   [% FOREACH shipto = vc_obj.shipto %]
24     ,
25     { shiptoname:         "[% JavaScript.escape(shipto.shiptoname) %]",
26       shiptodepartment_1: "[% JavaScript.escape(shipto.shiptodepartment_1) %]",
27       shiptodepartment_2: "[% JavaScript.escape(shipto.shiptodepartment_2) %]",
28       shiptostreet:       "[% JavaScript.escape(shipto.shiptostreet) %]",
29       shiptozipcode:      "[% JavaScript.escape(shipto.shiptozipcode) %]",
30       shiptocity:         "[% JavaScript.escape(shipto.shiptocity) %]",
31       shiptocountry:      "[% JavaScript.escape(shipto.shiptocountry) %]",
32       shiptogln:          "[% JavaScript.escape(shipto.shiptogln) %]",
33       shiptocontact:      "[% JavaScript.escape(shipto.shiptocontact) %]",
34       shiptocp_gender:    "[% JavaScript.escape(shipto.shiptocp_gender) %]",
35       shiptophone:        "[% JavaScript.escape(shipto.shiptophone) %]",
36       shiptofax:          "[% JavaScript.escape(shipto.shiptofax) %]",
37       shiptoemail:        "[% JavaScript.escape(shipto.shiptoemail) %]"
38     [% FOREACH var = shipto.cvars_by_config %]
39       , "shiptocvar_[% JavaScript.escape(var.config.name) %]": "[% JavaScript.escape(var.value_as_text) %]"
40     [% END %]
41     }
42   [% END %]
43   ];
44
45   function copy_address() {
46     var shipto = addresses[ $('#shipto_to_copy').val() ];
47     for (key in shipto)
48       $('#' + key).val(shipto[key]);
49   }
50
51   function clear_fields() {
52     var shipto = addresses[0];
53     for (key in shipto)
54       $('#' + key).val('');
55     $('#shiptocp_gender').val('m');
56   }
57
58   function clear_shipto_id_before_submit() {
59     var shipto = addresses[0];
60     for (key in shipto)
61       if ((key != 'shiptocp_gender') && ($('#' + key).val() != '')) {
62         $('#shipto_id').val('');
63         break;
64       }
65
66     $('form').submit();
67   }
68 </script>
69
70 [% select_options = [ [ 0, LxERP.t8("Billing Address") ] ] ;
71    FOREACH shipto = vc_obj.shipto ;
72      tmpcity  = shipto.shiptozipcode _ ' ' _ shipto.shiptocity ;
73      tmptitle = [ shipto.shiptoname, shipto.shiptostreet, tmpcity ] ;
74      CALL select_options.import([ [ loop.count, tmptitle.grep('\S').join("; ") ] ]) ;
75    END ;
76    '' %]
77
78  <form method="post" action="[% HTML.escape(script) %]">
79   [% L.hidden_tag("shipto_id", shipto_id) %]
80
81   <p>
82    [% LxERP.t8("Copy address from master data") %]:
83    [% L.select_tag("", select_options, id="shipto_to_copy", style="width: 400px") %]
84    [% L.button_tag("copy_address()", LxERP.t8("Copy")) %]
85    [% L.button_tag("clear_fields()", LxERP.t8("Clear fields")) %]
86   </p>
87
88   <table>
89    <tr class="listheading">
90     <th colspan="2" width="50%">[% LxERP.t8('Billing Address') %]</th>
91     <th width="50%">[% LxERP.t8('Shipping Address') %]</th>
92    </tr>
93    <tr height="5"></tr>
94    <tr>
95     <th align="right" nowrap>[%- IF vc == "customer" %][%- LxERP.t8('Customer Number') %][%- ELSE %][%- LxERP.t8('Vendor Number') %][%- END %]</th>
96     <td>[%- IF vc == "customer" %][%- HTML.escape(customernumber) %][%- ELSE %][%- HTML.escape(vendornumber) %][%- END %]</td>
97    </tr>
98    <tr>
99     <th align="right" nowrap>[% LxERP.t8('Company Name') %]</th>
100     <td>[% HTML.escape(name) %]</td>
101     <td>[% L.input_tag("shiptoname", shiptoname, "size", "35") %]</td>
102    </tr>
103    <tr>
104     <th align="right" nowrap>[% LxERP.t8('Department') %]</th>
105     <td>[% HTML.escape(department_1) %]</td>
106     <td>[% L.input_tag("shiptodepartment_1", shiptodepartment_1, "size", "35") %]</td>
107    </tr>
108    <tr>
109     <th align="right" nowrap>&nbsp;</th>
110     <td>[% HTML.escape(department_2) %]</td>
111     <td>[% L.input_tag("shiptodepartment_2", shiptodepartment_2, "size", "35") %]</td>
112    </tr>
113    <tr>
114     <th align="right" nowrap>[% LxERP.t8('Street') %]</th>
115     <td>[% HTML.escape(street) %]</td>
116     <td>[% L.input_tag("shiptostreet", shiptostreet, "size", "35") %]</td>
117    </tr>
118    <tr>
119     <th align="right" nowrap>[% LxERP.t8('Zipcode') %]</th>
120     <td>[% HTML.escape(zipcode) %]</td>
121     <td>[% L.input_tag("shiptozipcode", shiptozipcode, "size", "35") %]</td>
122    </tr>
123    <tr>
124     <th align="right" nowrap>[% LxERP.t8('City') %]</th>
125     <td>[% HTML.escape(city) %]</td>
126     <td>[% L.input_tag("shiptocity", shiptocity, "size", "35") %]</td>
127    </tr>
128    <tr>
129     <th align="right" nowrap>[% LxERP.t8('Country') %]</th>
130     <td>[% HTML.escape(country) %]</td>
131     <td>[% L.input_tag("shiptocountry", shiptocountry, "size", "35") %]</td>
132    </tr>
133    <tr>
134     <th align="right" nowrap>[% LxERP.t8('GLN') %]</th>
135     <td>[% HTML.escape(gln) %]</td>
136     <td>[% L.input_tag("shiptogln", shiptogln, "size", "35") %]</td>
137    </tr>
138    <tr>
139     <th align="right" nowrap>[% LxERP.t8('Contact') %]</th>
140     <td>[% HTML.escape(contact) %]</td>
141     <td>[% L.input_tag("shiptocontact", shiptocontact, "size", "35") %]</td>
142    </tr>
143    <tr>
144     <th align="right" nowrap>[% LxERP.t8('Gender') %]</th>
145     <td></td>
146     <td>
147      [% L.select_tag('shiptocp_gender', [ [ 'm', LxERP.t8('male') ], [ 'f', LxERP.t8('female') ] ], 'default' = shiptocp_gender) %]
148     </td>
149    </tr>
150    <tr>
151     <th align="right" nowrap>[% LxERP.t8('Phone') %]</th>
152     <td>[% HTML.escape(phone) %]</td>
153     <td>[% L.input_tag("shiptophone", shiptophone, "size", "35") %]</td>
154    </tr>
155    <tr>
156     <th align="right" nowrap>[% LxERP.t8('Fax') %]</th>
157     <td>[% HTML.escape(fax) %]</td>
158     <td>[% L.input_tag("shiptofax", shiptofax, "size", "35") %]</td>
159    </tr>
160    <tr>
161     <th align="right" nowrap>[% LxERP.t8('E-mail') %]</th>
162     <td>[% HTML.escape(email) %]</td>
163     <td>[% L.input_tag("shiptoemail", shiptoemail, "size", "35") %]</td>
164    </tr>
165 [% FOREACH var = cvars %]
166    <tr valign="top">
167     <th align="right" nowrap>[% HTML.escape(var.config.description) %]</th>
168     <td></td>
169     <td>[% INCLUDE 'common/render_cvar_input.html' cvar_name_prefix='shiptocvar_' %]</td>
170    </tr>
171 [% END %]
172   </table>
173
174   <hr size="3" noshade>
175
176   [% L.hidden_tag("action", "ship_to_entered") %]
177   [% L.hidden_tag("nextsub", nextsub) %]
178   [% L.hidden_tag("previousform", previousform) %]
179
180   [% L.button_tag("clear_shipto_id_before_submit()", LxERP.t8("Continue")) %]
181  </form>