PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | includes/order_edit_form.php +2329 -1285 1.3.22.12.4 View file →
@@ -1,1285 +1,2329 @@
1 -<?php
2 -$status = $this->action_status;
3 -$message = $this->action_message;
4 -$this->action_status = 'none';
5 -$this->action_message = '';
6 -
7 -$pname = array();
8 -$payment_method = array();
9 -
10 -$management_status = apply_filters( 'usces_filter_management_status', get_option('usces_management_status') );
11 -$payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
12 -foreach( $payment_method as $pmet){
13 - $pname[] = $pmet['name'];
14 -}
15 -if( !in_array( __('Transfer (prepayment)', 'usces'), $pname) ){
16 - $newp['name'] = __('Transfer (prepayment)', 'usces');
17 - $newp['explanation'] = '';
18 - $newp['settlement'] = 'transferAdvance';
19 - $newp['module'] = '';
20 - $payment_method[] = $newp;
21 -}
22 -if( !in_array( __('Transfer (postpay)', 'usces'), $pname) ){
23 - $newp['name'] = __('Transfer (postpay)', 'usces');
24 - $newp['explanation'] = '';
25 - $newp['settlement'] = 'transferDeferred';
26 - $newp['module'] = '';
27 - $payment_method[] = $newp;
28 -}
29 -if( !in_array( __('COD', 'usces'), $pname) ){
30 - $newp['name'] = __('COD', 'usces');
31 - $newp['explanation'] = '';
32 - $newp['settlement'] = 'COD';
33 - $newp['module'] = '';
34 - $payment_method[] = $newp;
35 -}
36 -
37 -if($order_action == 'new'){
38 -
39 - $oa = 'newpost';
40 - $taio = 'new';
41 - $admin = 'adminorder';
42 - $receipt = '';
43 - $ordercheck = array();
44 - $order_delivery_method = -1;
45 - $order_id = NULL;
46 -
47 - $csod_meta = usces_has_custom_field_meta('order');
48 - if(is_array($csod_meta)) {
49 - $keys = array_keys($csod_meta);
50 - foreach($keys as $key) {
51 - $csod_key = 'csod_'.$key;
52 - $csod_meta[$key]['data'] = NULL;
53 - }
54 - }
55 - $cscs_meta = usces_has_custom_field_meta('customer');
56 - if(is_array($cscs_meta)) {
57 - $keys = array_keys($cscs_meta);
58 - foreach($keys as $key) {
59 - $cscs_key = 'cscs_'.$key;
60 - $cscs_meta[$key]['data'] = NULL;
61 - }
62 - }
63 - $csde_meta = usces_has_custom_field_meta('delivery');
64 - if(is_array($csde_meta)) {
65 - $keys = array_keys($csde_meta);
66 - foreach($keys as $key) {
67 - $csde_key = 'csde_'.$key;
68 - $csde_meta[$key]['data'] = NULL;
69 - }
70 - }
71 -
72 - $data = array(
73 - 'mem_name1' => '',
74 - 'mem_name2' => '',
75 - 'mem_name3' => '',
76 - 'mem_name4' => '',
77 - 'mem_zip' => '',
78 - 'mem_address1' => '',
79 - 'mem_address2' => '',
80 - 'mem_address3' => '',
81 - 'mem_tel' => '',
82 - 'mem_fax' => '',
83 - 'mem_country' => '',
84 - 'mem_pref' => '',
85 - 'order_name1' => '',
86 - 'order_name2' => '',
87 - 'order_name3' => '',
88 - 'order_name4' => '',
89 - 'order_zip' => '',
90 - 'order_address1' => '',
91 - 'order_address2' => '',
92 - 'order_address3' => '',
93 - 'order_tel' => '',
94 - 'order_fax' => '',
95 - 'order_country' => '',
96 - 'order_pref' => '',
97 - 'ID' => '',
98 - 'order_date' => current_time('mysql'),
99 - 'order_delivery_date' => '',
100 - );
101 - $deli = array(
102 - 'name1' => '',
103 - 'name2' => '',
104 - 'name3' => '',
105 - 'name4' => '',
106 - 'zipcode' => '',
107 - 'address1' => '',
108 - 'address2' => '',
109 - 'address3' => '',
110 - 'tel' => '',
111 - 'fax' => '',
112 - 'country' => '',
113 - 'pref' => ''
114 - );
115 - $condition = $this->get_condition();
116 - $cart = array();
117 -
118 -
119 -}else{
120 -
121 - $oa = 'editpost';
122 -
123 - $order_id = $_REQUEST['order_id'];
124 -
125 - global $wpdb;
126 -
127 - $tableName = $wpdb->prefix . "usces_order";
128 - $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $order_id);
129 - $data = $wpdb->get_row( $query, ARRAY_A );
130 -
131 - $deli = stripslashes_deep(unserialize($data['order_delivery']));
132 - $cart = stripslashes_deep(unserialize($data['order_cart']));
133 - $condition = stripslashes_deep(unserialize($data['order_condition']));
134 - $ordercheck = stripslashes_deep(unserialize($data['order_check']));
135 - if( !is_array($ordercheck) ) $ordercheck = array();
136 - $order_delivery_method = $data['order_delivery_method'];
137 -
138 - if( !empty($data) ){
139 - $data = stripslashes_deep($data);
140 - }
141 - foreach ($management_status as $status_key => $status_name){
142 - if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
143 - continue;
144 -
145 - if($this->is_status($status_key, $data['order_status'])){
146 - $taio = $status_key;
147 - break;
148 - }else{
149 - $taio = 'new';
150 - }
151 - }
152 -
153 - if($this->is_status('estimate', $data['order_status']))
154 - $admin = 'estimate';
155 - else if($this->is_status('adminorder', $data['order_status']))
156 - $admin = 'adminorder';
157 - else
158 - $admin = '';
159 -
160 - if($this->is_status('noreceipt', $data['order_status']))
161 - $receipt = 'noreceipt';
162 - else if($this->is_status('receipted', $data['order_status']))
163 - $receipt = 'receipted';
164 - else if($this->is_status('pending', $data['order_status']))
165 - $receipt = 'pending';
166 - else
167 - $receipt = '';
168 -
169 -//20100818ysk start
170 - $csod_meta = usces_has_custom_field_meta('order');
171 - if(is_array($csod_meta)) {
172 - $keys = array_keys($csod_meta);
173 - foreach($keys as $key) {
174 - $csod_key = 'csod_'.$key;
175 - $csod_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csod_key, $order_id));
176 - }
177 - }
178 - $cscs_meta = usces_has_custom_field_meta('customer');
179 - if(is_array($cscs_meta)) {
180 - $keys = array_keys($cscs_meta);
181 - foreach($keys as $key) {
182 - $cscs_key = 'cscs_'.$key;
183 - $cscs_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($cscs_key, $order_id));
184 - }
185 - }
186 - $csde_meta = usces_has_custom_field_meta('delivery');
187 - if(is_array($csde_meta)) {
188 - $keys = array_keys($csde_meta);
189 - foreach($keys as $key) {
190 - $csde_key = 'csde_'.$key;
191 - $csde_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csde_key, $order_id));
192 - }
193 - }
194 -//20100818ysk end
195 -}
196 -
197 -?>
198 -<script type="text/javascript">
199 -jQuery(function($){
200 -<?php if($status == 'success'){ ?>
201 - $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
202 -<?php }else if($status == 'caution'){ ?>
203 - $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
204 -<?php }else if($status == 'error'){ ?>
205 - $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
206 -<?php } ?>
207 - var selected_delivery_time = '<?php esc_html_e(isset($data['order_delivery_time']) ? $data['order_delivery_time'] : ''); ?>';
208 - var delivery_time = [];
209 -<?php
210 - foreach((array)$this->options['delivery_method'] as $dmid => $dm){
211 - $lines = split("\n", $dm['time']);
212 -?>
213 - delivery_time[<?php echo $dm['id']; ?>] = [];
214 -<?php
215 - foreach((array)$lines as $line){
216 - if(trim($line) != ''){
217 -?>
218 - delivery_time[<?php echo $dm['id']; ?>].push("<?php echo trim($line); ?>");
219 -<?php }
220 - }
221 - }
222 -?>
223 -
224 - $("#order_payment_name").change(function () {
225 - var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
226 -//20101018ysk start
227 - //if( uscesPayments[pay_name] == 'transferAdvance' || uscesPayments[pay_name] == 'transferDeferred'){
228 - if( uscesPayments[pay_name] == 'transferAdvance'
229 - || uscesPayments[pay_name] == 'transferDeferred'
230 - || uscesPayments[pay_name] == 'acting_remise_conv'
231 - || uscesPayments[pay_name] == 'acting_zeus_bank'
232 - || uscesPayments[pay_name] == 'acting_zeus_conv'
233 - || uscesPayments[pay_name] == 'acting_jpayment_conv'
234 - || uscesPayments[pay_name] == 'acting_jpayment_bank'){
235 -//20101018ysk end
236 - var label = '<?php _e('transfer statement', 'usces'); ?>';
237 - var html = "<select name='offer[receipt]'>\n";
238 - html += "<option value='noreceipt'><?php echo $management_status['noreceipt']; ?></option>\n";
239 - html += "<option value='receipted'><?php echo $management_status['receipted']; ?></option>\n";
240 - html += "</select>\n";
241 - $("#receiptlabel").html(label);
242 - $("#receiptbox").html(html);
243 - }else{
244 - $("#receiptlabel").html('');
245 - $("#receiptbox").html('');
246 - }
247 - });
248 -
249 - $("#addItemDialog").dialog({
250 - bgiframe: true,
251 - autoOpen: false,
252 - height: 500,
253 - width: 700,
254 - resizable: true,
255 - modal: true,
256 - buttons: {
257 - '<?php _e('close', 'usces'); ?>': function() {
258 - $(this).dialog('close');
259 - }
260 - },
261 - close: function() {
262 - $("#newitemform").html( "" );
263 - $('#newitemcode').val('');
264 - }
265 - });
266 - $('#addCartButton').click(function() {
267 - if($("input[name='order_id']").val() == ''){
268 - alert("<?php _e("Push 'change decision' button, to be settled with an order number.", 'usces'); ?>");
269 - return;
270 - }
271 - $('#addItemDialog').dialog('open');
272 - });
273 - $('#delivery_method_select').change(function() {
274 - orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
275 - });
276 -
277 - $("#mailSendDialog").dialog({
278 - bgiframe: true,
279 - autoOpen: false,
280 - height: 650,
281 - width: 700,
282 - resizable: true,
283 - modal: true,
284 - buttons: {
285 - '<?php _e('close', 'usces'); ?>': function() {
286 - $(this).dialog('close');
287 - }
288 - },
289 - close: function() {
290 - $("#sendmailmessage").html( "" );
291 - $('#sendmailaddress').val('');
292 - }
293 - });
294 - $('#completionMail').click(function() {
295 - orderItem.getmailmessage('completionMail');
296 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
297 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
298 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['completionmail'], $data, 'completionMail')); ?>');
299 - $('#mailChecked').val('completionmail');
300 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for Shipping', 'usces'); ?>');
301 - $('#mailSendDialog').dialog('open');
302 - });
303 - $('#orderConfirmMail').click(function() {
304 - orderItem.getmailmessage('orderConfirmMail');
305 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
306 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
307 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['ordermail'], $data, 'orderConfirmMail')); ?>');
308 - $('#mailChecked').val('ordermail');
309 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of order', 'usces'); ?>');
310 - $('#mailSendDialog').dialog('open');
311 - });
312 - $('#changeConfirmMail').click(function() {
313 - orderItem.getmailmessage('changeConfirmMail');
314 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
315 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
316 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['changemail'], $data, 'changeConfirmMail')); ?>');
317 - $('#mailChecked').val('changemail');
318 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confiemation of change', 'usces'); ?>');
319 - $('#mailSendDialog').dialog('open');
320 - });
321 - $('#receiptConfirmMail').click(function() {
322 - orderItem.getmailmessage('receiptConfirmMail');
323 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
324 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
325 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['receiptmail'], $data, 'receiptConfirmMail')); ?>');
326 - $('#mailChecked').val('receiptmail');
327 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of transter', 'usces'); ?>');
328 - $('#mailSendDialog').dialog('open');
329 - });
330 - $('#mitumoriConfirmMail').click(function() {
331 - orderItem.getmailmessage('mitumoriConfirmMail');
332 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
333 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
334 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['mitumorimail'], $data, 'mitumoriConfirmMail')); ?>');
335 - $('#mailChecked').val('mitumorimail');
336 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('estimate mail', 'usces'); ?>');
337 - $('#mailSendDialog').dialog('open');
338 - });
339 - $('#cancelConfirmMail').click(function() {
340 - orderItem.getmailmessage('cancelConfirmMail');
341 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
342 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
343 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['cancelmail'], $data, 'cancelConfirmMail')); ?>');
344 - $('#mailChecked').val('cancelmail');
345 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Cancelling mail', 'usces'); ?>');
346 - $('#mailSendDialog').dialog('open');
347 - });
348 - $('#otherConfirmMail').click(function() {
349 - orderItem.getmailmessage('otherConfirmMail');
350 - $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
351 - $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
352 - $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['othermail'], $data, 'otherConfirmMail')); ?>');
353 - $('#mailChecked').val('othermail');
354 - $('#mailSendDialog').dialog('option', 'title', '<?php _e('Other mail', 'usces'); ?>');
355 - $('#mailSendDialog').dialog('open');
356 - });
357 -
358 - $("#mailSendAlert").dialog({
359 - bgiframe: true,
360 - autoOpen: false,
361 - height: 200,
362 - width: 200,
363 - resizable: false,
364 - modal: false
365 - });
366 - $("#sendmail").click(function() {
367 - uscesMail.sendmail();
368 - });
369 -
370 - $("#PDFDialog").dialog({
371 - bgiframe: true,
372 - autoOpen: false,
373 - height: 800,
374 - width: 700,
375 - resizable: true,
376 - modal: true,
377 - buttons: {
378 - '<?php _e('close', 'usces'); ?>': function() {
379 - $(this).dialog('close');
380 - }
381 - },
382 - close: function() {
383 - $("#new_pdf").html( "" );
384 - }
385 - });
386 - $('#mitumoriprint').click(function() {
387 - $('#new_pdf').html('<iframe src="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>&type=mitumori" align="center" width="660" height=670" border="1" marginheight="0" marginwidth="0"></iframe>');
388 - $('#PDFDialog').dialog('option', 'title', '<?php _e('print out the estimate', 'usces'); ?>');
389 - $('#PDFDialog').dialog('open');
390 - uscesMail.ordercheckpost('mitumoriprint');
391 - });
392 - $('#nohinprint').click(function() {
393 - $('#new_pdf').html('<iframe src="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>&type=nohin" align="center" width="660" height=670" border="1" marginheight="0" marginwidth="0"></iframe>');
394 - $('#PDFDialog').dialog('option', 'title', '<?php _e('print out Delivery Statement', 'usces'); ?>');
395 - $('#PDFDialog').dialog('open');
396 - uscesMail.ordercheckpost('nohinprint');
397 - });
398 - $('#receiptprint').click(function() {
399 - $('#new_pdf').html('<iframe src="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>&type=receipt" align="center" width="660" height=670" border="1" marginheight="0" marginwidth="0"></iframe>');
400 - $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Receipt', 'usces'); ?>');
401 - $('#PDFDialog').dialog('open');
402 - uscesMail.ordercheckpost('receiptprint');
403 - });
404 - $('#billprint').click(function() {
405 - $('#new_pdf').html('<iframe src="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>&type=bill" align="center" width="660" height=670" border="1" marginheight="0" marginwidth="0"></iframe>');
406 - $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Invoice', 'usces'); ?>');
407 - $('#PDFDialog').dialog('open');
408 - uscesMail.ordercheckpost('billprint');
409 - });
410 -
411 - orderfunc = {
412 - sumPrice : function(obj) {
413 - if(obj != null) {
414 -//20120606ysk start 0000497
415 - //if(!checkNum(obj.val())) {
416 - if(!checkNumMinus(obj.val())) {
417 -//20120606ysk end
418 - alert('数値で入力して下さい。');
419 - obj.focus();
420 - return false;
421 - }
422 - }
423 -
424 - var p = $("input[name*='skuPrice']");
425 - var q = $("input[name*='quant']");
426 - var t = $("td[id*='sub_total']");
427 - var db = $("input[name*='delButton']");
428 - var price = [];
429 - var quant = [];
430 - var sub_total = <?php echo apply_filters('order_edit_form_sub_total', 0, $data); ?>;
431 - var total_full = 0;
432 - for( var i = 0; i < p.length; i++) {
433 - v = parseFloat($(p[i]).val()) * $(q[i]).val();
434 - $(t[i]).html(addComma(v+''));
435 - //$(t[i]).html(v);
436 - sub_total += v;
437 - }
438 - $("#item_total").html(addComma(sub_total+''));
439 - var order_usedpoint = $("#order_usedpoint").val()*1;
440 - var order_discount = parseFloat($("#order_discount").val());
441 - var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
442 - var order_cod_fee = parseFloat($("#order_cod_fee").val());
443 - var order_tax = parseFloat($("#order_tax").val());
444 - total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
445 - $("#total_full").html(addComma(total_full+''));
446 - $("#total_full_top").html(addComma(total_full+''));
447 - <?php do_action( 'order_edit_form_sumPrice',$data); ?>
448 - },
449 - make_delivery_time : function(selected) {
450 - var option = '';
451 - if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
452 - option += '<option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>' + "\n";
453 - }else{
454 - for(var i=0; i<delivery_time[selected].length; i++){
455 - if( delivery_time[selected][i] == selected_delivery_time ) {
456 - option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
457 - }else{
458 - option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
459 - }
460 - }
461 - }
462 - $("#delivery_time_select").html(option);
463 -
464 - },
465 - getMember : function( email ) {
466 - var s = orderfunc.settings;
467 - s.url = uscesL10n.requestFile;
468 - s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email);
469 - s.success = function(data, dataType){
470 - var values = data.split('#usces#');
471 - if( 'ok' == values[0]){
472 - for(var i=1; i<values.length; i++){
473 - var val = values[i].split('=');
474 - if( 'member_id' == val[0] ){
475 - $("#member_id_label").html(val[1]);
476 - $("#member_id").val(val[1]);
477 - }else{
478 - $(":input[name='" + val[0] + "']").val(val[1]);
479 - }
480 - }
481 - }else if( 'none' == values[0]){
482 - alert( '該当する会員情報は存在しません。' );
483 - }else{
484 - alert( 'ERROR' );
485 - }
486 - };
487 - s.error = function(data, dataType){
488 - alert( 'ERROR' );
489 - };
490 - $.ajax( s );
491 - return false;
492 - },
493 - recalculation : function() {
494 - <?php $script = "
495 - var p = $(\"input[name*='skuPrice']\");
496 - var q = $(\"input[name*='quant']\");
497 - var post_ids = '';
498 - var skus = '';
499 - var prices = '';
500 - var quants = '';
501 - for( var i = 0; i < p.length; i++) {
502 - name = $(p[i]).attr(\"name\");
503 - strs = name.split('[');
504 - post_ids += strs[2].replace(/[\]]+$/g, '')+'#usces#';
505 - skus += strs[3].replace(/[\]]+$/g, '')+'#usces#';
506 - prices += parseFloat($(p[i]).val())+'#usces#';
507 - quants += $(q[i]).val()+'#usces#';
508 - }
509 - var order_usedpoint = $(\"#order_usedpoint\").val()*1;
510 - var order_shipping_charge = parseFloat($(\"#order_shipping_charge\").val());
511 - var order_cod_fee = parseFloat($(\"#order_cod_fee\").val());
512 - var s = orderfunc.settings;
513 - s.url = uscesL10n.requestFile;
514 - s.data = 'action=order_item_ajax&mode=recalculation&order_id='+$('#order_id').val()+'&mem_id='+$('#member_id_label').html()+'&post_ids='+post_ids+'&skus='+skus+'&prices='+prices+'&quants='+quants+'&use_point='+order_usedpoint+'&shipping_charge='+order_shipping_charge+'&cod_fee='+order_cod_fee;
515 - s.success = function(data, dataType) {
516 - var values = data.split('#usces#');
517 - if( 'ok' == values[0] ) {
518 - $(\"#order_discount\").val(values[1]);
519 - $(\"#order_tax\").val(values[2]);
520 - $(\"#order_getpoint\").val(values[3]);
521 - $(\"#total_full\").html(addComma(values[4]+''));
522 - $(\"#total_full_top\").html(addComma(values[4]+''));
523 - } else {
524 - alert( 'ERROR' );
525 - }
526 - };
527 - s.error = function(data, dataType) {
528 - alert( 'ERROR' );
529 - };
530 - $.ajax( s );
531 - return false;
532 - ";
533 - echo apply_filters( 'order_edit_form_recalculation',$script, $data);
534 - ?>
535 - },
536 - settings: {
537 - url: uscesL10n.requestFile,
538 - type: 'POST',
539 - cache: false,
540 - success: function(data, dataType){
541 - },
542 - error: function(msg){
543 - //$("#ajax-response").html(msg);
544 - }
545 - }
546 - };
547 -
548 - uscesMail = {
549 - sendmail : function() {
550 - if($("#sendmailaddress").val() == "") return;
551 -
552 - var address = encodeURIComponent($("#sendmailaddress").val());
553 - var message = encodeURIComponent($("#sendmailmessage").val());
554 - var name = encodeURIComponent($("#sendmailname").val());
555 - var subject = encodeURIComponent($("#sendmailsubject").val());
556 - var order_id = $("#order_id").val();
557 - var checked = $("#mailChecked").val();
558 -
559 - var s = uscesMail.settings;
560 - s.data = "action=order_item_ajax&mode=sendmail&mailaddress=" + address + "&message=" + message + "&name=" + name + "&subject=" + subject + "&order_id=" + order_id + "&checked=" + checked;
561 - s.success = function(data, dataType){
562 - if(data == 'success') {
563 - if(checked == 'completionmail'){
564 - $("input[name='check\[completionmail\]']").attr({checked: true});
565 - }else if(checked == 'ordermail'){
566 - $("input[name='check\[ordermail\]']").attr({checked: true});
567 - }else if(checked == 'changemail'){
568 - $("input[name='check\[changemail\]']").attr({checked: true});
569 - }else if(checked == 'receiptmail'){
570 - $("input[name='check\[receiptmail\]']").attr({checked: true});
571 - }else if(checked == 'mitumorimail'){
572 - $("input[name='check\[mitumorimail\]']").attr({checked: true});
573 - }else if(checked == 'cancelmail'){
574 - $("input[name='check\[cancelmail\]']").attr({checked: true});
575 - }else if(checked == 'othermail'){
576 - $("input[name='check\[othermail\]']").attr({checked: true});
577 - }
578 - <?php echo apply_filters('usces_filter_order_check_mail_js', '' ); ?>
579 -
580 - $('#mailSendAlert').dialog('option', 'buttons', {
581 - 'OK': function() {
582 - $(this).dialog('close');
583 - $('#mailSendDialog').dialog('close');
584 - }
585 - });
586 - $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
587 - $('#mailSendAlert fieldset').html('<p><?php _e('E-mail has been sent.', 'usces'); ?></p>');
588 - $('#mailSendAlert').dialog('open');
589 -
590 - }else if(data == 'error'){
591 - $('#mailSendAlert').dialog('option', 'buttons', {
592 - 'OK': function() {
593 - $(this).dialog('close');
594 - }
595 - });
596 - $('#mailSendAlert').dialog('option', 'title', 'ERROR');
597 - $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
598 - $('#mailSendAlert').dialog('open');
599 - }
600 - };
601 - s.error = function(data, dataType){
602 - $('#mailSendAlert').dialog('option', 'buttons', {
603 - 'OK': function() {
604 - $(this).dialog('close');
605 - }
606 - });
607 - $('#mailSendAlert').dialog('option', 'title', 'ERROR');
608 - $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
609 - $('#mailSendAlert').dialog('open');
610 - };
611 - $.ajax( s );
612 - return false;
613 - },
614 - ordercheckpost : function( checked ) {
615 - var p = uscesMail.settings;
616 - var order_id = $("#order_id").val();
617 - p.url = uscesL10n.requestFile;
618 - p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked;
619 - p.success = function(data, dataType){
620 - if(data == 'mitumoriprint'){
621 - $("input[name='check\[mitumoriprint\]']").attr({checked: true});
622 - }else if(data == 'nohinprint'){
623 - $("input[name='check\[nohinprint\]']").attr({checked: true});
624 - }
625 - <?php echo apply_filters('usces_filter_order_check_print_js', '' ); ?>
626 - };
627 - p.error = function(data, dataType){
628 - //$("#ajax-response").html(msg);
629 - };
630 - $.ajax( p );
631 - return false;
632 - },
633 - settings: {
634 - url: uscesL10n.requestFile,
635 - type: 'POST',
636 - cache: false,
637 - success: function(data, dataType){
638 - },
639 - error: function(msg){
640 - //$("#ajax-response").html(msg);
641 - }
642 - }
643 - };
644 -
645 - $('form').submit(function() {
646 - var error = 0;
647 -
648 - if( !checkNum( $("#order_usedpoint").val() ) ) {
649 - error++;
650 - $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
651 - $(this).css({'background-color': '#FFF'});
652 - });
653 - }
654 - if( !checkNum( $("#order_getdpoint").val() ) ) {
655 - error++;
656 - $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
657 - $(this).css({'background-color': '#FFF'});
658 - });
659 - }
660 - if( !checkPrice( $("#order_discount").val() ) ) {
661 - error++;
662 - $("#order_discount").css({'background-color': '#FFA'}).click(function() {
663 - $(this).css({'background-color': '#FFF'});
664 - });
665 - }
666 - if( !checkPrice( $("#order_shipping_charge").val() ) ) {
667 - error++;
668 - $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
669 - $(this).css({'background-color': '#FFF'});
670 - });
671 - }
672 - if( !checkPrice( $("#order_cod_fee").val() ) ) {
673 - error++;
674 - $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
675 - $(this).css({'background-color': '#FFF'});
676 - });
677 - }
678 - if( !checkPrice( $("#order_tax").val() ) ) {
679 - error++;
680 - $("#order_tax").css({'background-color': '#FFA'}).click(function() {
681 - $(this).css({'background-color': '#FFF'});
682 - });
683 - }
684 -
685 - if( 0 < error ) {
686 - $("#aniboxStatus").removeClass("none");
687 - $("#aniboxStatus").addClass("error");
688 - $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
689 - $("#info_massage").html("データに不備があります");
690 - $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
691 - return false;
692 - } else {
693 - return true;
694 - }
695 - });
696 - <?php do_action('usces_action_order_edit_page_js', $order_id, $data ); ?>
697 -<?php echo apply_filters('usces_filter_order_edit_page_js', '', $order_id ); ?>
698 -});
699 -
700 -function toggleVisibility(id) {
701 - var e = document.getElementById(id);
702 - if(e.style.display == 'block') {
703 - e.style.display = 'none';
704 - //document.getElementById("searchSwitchStatus").value = 'OFF';
705 - } else {
706 - e.style.display = 'block';
707 - //document.getElementById("searchSwitchStatus").value = 'ON';
708 - //document.getElementById("searchVisiLink").style.display = 'none';
709 - }
710 -};
711 -
712 -function addComma(str)
713 -{
714 - var strs = str.split('.');
715 - cnt = 0;
716 - n = "";
717 -//20120606ysk start 0000497
718 - m = "";
719 - if( strs[0].substr(0, 1) == "-" ) {
720 - m = "-";
721 - strs[0] = strs[0].substr(1);
722 - }
723 -//20120606ysk end
724 - for (i=strs[0].length-1; i>=0; i--)
725 - {
726 - n = strs[0].charAt(i) + n;
727 - cnt++;
728 - if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
729 - }
730 - n = m + n;//20120606ysk 0000497
731 - if(undefined != strs[1]){
732 - res = n + '.' + strs[1];
733 - }else{
734 - res = n;
735 - }
736 - return res;
737 -};
738 -
739 -function pdfWindow( type ) {
740 - var wx = 800;
741 - var wy = 900;
742 - var x = (screen.width- wx) / 2;
743 - var y = (screen.height - wy) / 2;
744 - x = 0;
745 - y = 0;
746 - printWin = window.open("<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>"+"&type="+type,"sub","left="+x+",top="+y+",width="+wx+",height="+wy+",scrollbars=yes");
747 -}
748 -//20120606ysk start 0000497
749 -function checkNumMinus( argValue ) {
750 - if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
751 - return false;
752 - }
753 - return true;
754 -}
755 -//20120606ysk end
756 -//20120307ysk start 0000432
757 -function delConfirm(){
758 - if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
759 - return true;
760 - }else{
761 - return false;
762 - }
763 -}
764 -//20120307ysk end
765 -
766 -jQuery(document).ready(function($){
767 -//20120528ysk start 0000485
768 -// var p = $("input[name*='skuPrice']");
769 -// var q = $("input[name*='quant']");
770 -// var t = $("td[id*='sub_total']");
771 -// var db = $("input[name*='delButton']");
772 -
773 - orderfunc.sumPrice(null);
774 -
775 -// for( var i = 0; i < p.length; i++) {
776 -// $(p[i]).bind("change", function(){ orderfunc.sumPrice($(p[i])); });
777 -// $(q[i]).bind("change", function(){ orderfunc.sumPrice($(q[i])); });
778 -// $(db[i]).bind("click", function(){ return delConfirm($(db[i])); });
779 -// }
780 - $("input[name*='skuPrice']").bind("change", function(){ orderfunc.sumPrice($(this)); });
781 - $("input[name*='quant']").bind("change", function(){ orderfunc.sumPrice($(this)); });
782 - $("input[name*='delButton']").bind("click", function(){ orderfunc.sumPrice(null); });
783 -//20120528ysk end
784 - $("#order_usedpoint").bind("change", function(){ orderfunc.sumPrice($("#order_usedpoint")); });
785 - $("#order_discount").bind("change", function(){ orderfunc.sumPrice($("#order_discount")); });
786 - $("#order_shipping_charge").bind("change", function(){ orderfunc.sumPrice($("#order_shipping_charge")); });
787 - $("#order_cod_fee").bind("change", function(){ orderfunc.sumPrice($("#order_cod_fee")); });
788 - $("#order_tax").bind("change", function(){ orderfunc.sumPrice($("#order_tax")); });
789 - $("input[name*='upButton']").click(function(){
790 - if( ('completion' == $("#order_taio option:selected").val() || 'continuation' == $("#order_taio option:selected").val()) && '<?php echo substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); ?>' != $('#modified').val() ){
791 - if( confirm("<?php _e("更新日を今日の日付に変更しますか?", 'usces'); ?>\n<?php _e("更新日を変更せずに更新する場合はキャンセルを押してください。", 'usces'); ?>") ){
792 - $('#up_modified').val('update');
793 - }else{
794 - $('#up_modified').val('');
795 - }
796 - }
797 - return true;
798 - });
799 -
800 -//20120307ysk start 0000432
801 - //function delConfirm(){
802 - // if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
803 - // return true;
804 - // }else{
805 - // return false;
806 - // }
807 - //}
808 -//20120307ysk end
809 -
810 - orderfunc.make_delivery_time(<?php echo $order_delivery_method; ?>);
811 -
812 - $("#get_member").click(function(){
813 - if( '' == $("input[name='customer[mailaddress]']").val() ){
814 - alert('e-mail を入力して下さい。');
815 - return;
816 - }
817 - if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
818 -//20120914ysk start 0000567
819 - //if( confirm('顧客情報、発送先情報を上書きします。よろしいですか?') ){
820 - if( !confirm('顧客情報、発送先情報を上書きします。よろしいですか?') ){
821 - //orderfunc.getMember($("input[name='customer[mailaddress]']").val());
822 - return;
823 - }
824 - }
825 - orderfunc.getMember($("input[name='customer[mailaddress]']").val());
826 -//20120914ysk end
827 - });
828 -<?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
829 - $("#costomercopy").click(function() {
830 - if( '' != $("input[name='delivery[name1]']").val() ||
831 - '' != $("input[name='delivery[name2]']").val() ||
832 - '' != $("input[name='delivery[name3]']").val() ||
833 - '' != $("input[name='delivery[name4]']").val() ||
834 - '' != $("input[name='delivery[zipcode]']").val() ||
835 - '' != $("input[name='delivery[address1]']").val() ||
836 - '' != $("input[name='delivery[address2]']").val() ||
837 - '' != $("input[name='delivery[address3]']").val() ||
838 - '' != $("input[name='delivery[tel]']").val() ||
839 - '' != $("input[name='delivery[fax]']").val() ) {
840 - if( !confirm('顧客住所を発送先住所に上書きします。よろしいですか?') )
841 - return;
842 - }
843 - $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
844 - $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
845 - $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
846 - $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
847 - $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
848 - $("#delivery_country").val($("#customer_country option:selected").val());
849 - $("#delivery_pref").val($("#customer_pref option:selected").val());
850 - $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
851 - $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
852 - $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
853 - $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
854 - $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
855 - });
856 -<?php endif;//20120319ysk end ?>
857 -
858 - $("#recalc").click(function(){ orderfunc.recalculation(); });
859 -});
860 -</script>
861 -<div class="wrap">
862 -<div class="usces_admin">
863 -<form action="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action='.$oa; ?>" method="post" name="editpost">
864 -
865 -<h2>Welcart Management <?php _e('Edit order data','usces'); ?></h2>
866 -<p class="version_info">Version <?php echo USCES_VERSION; ?></p>
867 -<div id="aniboxStatus" class="<?php echo $status; ?>">
868 - <div id="anibox" class="clearfix">
869 - <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
870 - <div class="mes" id="info_massage"><?php echo $message; ?></div>
871 - </div>
872 -</div>
873 -<div class="mailVisiLink">
874 -<a style="cursor:pointer;" id="mailVisiLink" onclick="toggleVisibility('mailBox');"><?php _e('show the mail/print field', 'usces'); ?></a><br /><a href="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>"><?php _e('Back', 'usces'); ?></a>
875 -</div>
876 -<div class="ordernavi"><input name="upButton" class="upButton" type="submit" value="<?php _e('change decision', 'usces'); ?>" /><?php _e("When you change amount, please click 'Edit' before you finish your process.", 'usces'); ?></div>
877 -<div id="mailBox">
878 -<table>
879 -<tr>
880 -<td><input name="check[ordermail]" type="checkbox" value="ordermail"<?php if(isset($ordercheck['ordermail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="orderConfirmMail"><?php _e('Mail for confirmation of order', 'usces'); ?></a></td>
881 -<td><input name="check[changemail]" type="checkbox" value="changemail"<?php if(isset($ordercheck['changemail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="changeConfirmMail"><?php _e('Mail for confiemation of change', 'usces'); ?></a></td>
882 -<td><input name="check[receiptmail]" type="checkbox" value="receiptmail"<?php if(isset($ordercheck['receiptmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="receiptConfirmMail"><?php _e('Mail for confirmation of transter', 'usces'); ?></a></td>
883 -<td><input name="check[mitumorimail]" type="checkbox" value="mitumorimail"<?php if(isset($ordercheck['mitumorimail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="mitumoriConfirmMail"><?php _e('estimate mail', 'usces'); ?></a></td>
884 -<td><input name="check[cancelmail]" type="checkbox" value="cancelmail"<?php if(isset($ordercheck['cancelmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="cancelConfirmMail"><?php _e('Cancelling mail', 'usces'); ?></a></td>
885 -<td><input name="check[othermail]" type="checkbox" value="othermail"<?php if(isset($ordercheck['othermail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="otherConfirmMail"><?php _e('Other mail', 'usces'); ?></a></td>
886 -</tr>
887 -<tr>
888 -<td><input name="check[completionmail]" type="checkbox" value="completionmail"<?php if(isset($ordercheck['completionmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="completionMail"><?php _e('Mail for Shipping', 'usces'); ?></a></td>
889 -<td><input name="check[mitumoriprint]" type="checkbox" value="mitumoriprint"<?php if(isset($ordercheck['mitumoriprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="mitumoriprint"><?php _e('print out the estimate', 'usces'); ?></a></td>
890 -<td><input name="check[nohinprint]" type="checkbox" value="nohinprint"<?php if(isset($ordercheck['nohinprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="nohinprint"><?php _e('print out Delivery Statement', 'usces'); ?></a></td>
891 -<td><input name="check[billprint]" type="checkbox" value="billprint"<?php if(isset($ordercheck['billprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="billprint"><?php _e('Print Invoice', 'usces'); ?></a></td>
892 -<td><input name="check[receiptprint]" type="checkbox" value="receiptprint"<?php if(isset($ordercheck['receiptprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="receiptprint"><?php _e('Print Receipt', 'usces'); ?></a></td>
893 -<?php echo apply_filters('usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
894 -</tr>
895 -<tr>
896 -<td colspan="12"><span style="color:#CC3300"><?php _e("When there is any change, please press the 'change decision' before you send or print.", 'usces'); ?></span></td>
897 -</tr>
898 -</table>
899 -</div>
900 -<div class="info_head">
901 -<table>
902 -<tr>
903 -<td colspan="6" class="midasi0"><?php _e('order details', 'usces'); ?></td>
904 -</tr>
905 -<tr>
906 -<td class="label border"><?php _e('Order number', 'usces'); ?><br />(<?php esc_html_e(isset($data['ID']) ? $data['ID'] : ''); ?>)</td><td class="col1 border"><div class="rod"><?php esc_html_e(isset($data['ID']) ? usces_get_deco_order_id( $data['ID'] ) : ''); ?></div></td>
907 -<td class="col3 label border"><?php _e('order date', 'usces'); ?></td><td class="col2 border"><div class="rod long"><?php esc_html_e(isset($data['order_date']) ? $data['order_date'] : ''); ?></div></td>
908 -<td class="label border"><?php echo apply_filters('usces_filter_admin_modified_label', __('shpping date', 'usces') ); ?></td><td class="border"><div id="order_modified" class="rod long"><?php esc_html_e(isset($data['order_modified']) ? $data['order_modified'] : ''); ?></div></td>
909 -</tr>
910 -<tr>
911 -<td class="label"><?php _e('membership number', 'usces'); ?></td><td class="col1"><div id="member_id_label" class="rod large short"><?php esc_html_e(isset($data['mem_id']) ? $data['mem_id'] : ''); ?></div><?php if($order_action == 'new'){ ?><input name="member_id" id="member_id" type="hidden" /><?php } ?></td>
912 -<td colspan="2" rowspan="10" class="wrap_td">
913 - <table border="0" cellspacing="0" class="cus_info">
914 - <tr>
915 - <td class="label">e-mail</td>
916 - <td class="col2"><input name="customer[mailaddress]" type="text" class="text long" value="<?php echo esc_attr(isset($data['order_email']) ? $data['order_email'] : ''); ?>" /><input name="get_member" type="button" id="get_member" value="会員情報取込" /></td>
917 - </tr>
918 -
919 -<?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
920 -
921 -</table></td>
922 -<?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
923 -<td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?><input type="button" id="costomercopy" value="発送先同じ"></td>
924 -<?php else : ?>
925 -<td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?></td>
926 -<?php endif;//20120319ysk end ?>
927 -</tr>
928 -<tr>
929 -<td class="label"><?php _e('payment method', 'usces'); ?></td>
930 -<td class="col1"><select name="offer[payment_name]" id="order_payment_name">
931 - <option value="#none#"><?php _e('-- Select --', 'usces'); ?></option>
932 -<?php
933 -if( $payment_method ) {
934 - foreach ((array)$payment_method as $payments) {
935 - if( $payments['name'] != '' ) {
936 - $selected = (isset($data['order_payment_name']) && $payments['name'] == $data['order_payment_name']) ? ' selected="selected"' : '';
937 -?>
938 - <option value="<?php echo esc_attr($payments['name']); ?>"<?php echo $selected; ?>><?php echo esc_attr($payments['name']); ?></option>
939 -<?php } } } ?>
940 -</select></td>
941 -<td colspan="2" rowspan="9" class="wrap_td">
942 -<table border="0" cellspacing="0" class="deli_info">
943 -
944 -<?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
945 -
946 -</table></td>
947 -</tr>
948 -<tr>
949 -<td class="label"><?php _e('shipping option','usces'); ?></td>
950 -<td class="col1"><select name="offer[delivery_method]" id="delivery_method_select">
951 - <option value="-1"><?php _e('Non-request', 'usces'); ?></option>
952 -<?php
953 -foreach ((array)$this->options['delivery_method'] as $dkey => $delivery) {
954 - $selected = $order_delivery_method == $delivery['id'] ? ' selected="selected"' : '';
955 - echo "\t<option value='" . esc_attr($delivery['id']) . "'{$selected}>" . esc_attr($delivery['name']) . "</option>\n";
956 -}
957 -?>
958 -</select></td>
959 -<?php //if( USCES_JP ): ?>
960 -</tr>
961 -<?php //endif; ?>
962 -<!--20101208ysk start-->
963 -<tr>
964 -<td class="label"><?php _e('Delivery date', 'usces'); ?></td>
965 -<td class="col1"><select name="offer[delivery_date]" id="delivery_date_select">
966 - <option value='<?php _e('Non-request', 'usces'); ?>'><?php _e('Non-request', 'usces'); ?></option>
967 -<?php
968 -$data_order_date = explode(" ", $data['order_date']);
969 -$order_date = explode("-", $data_order_date[0]);
970 -for($i = 0; $i < 50; $i++) {
971 - $value = date('Y-m-d', mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
972 - $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
973 - $selected = (isset($data['order_delivery_date']) && $data['order_delivery_date'] == $value) ? ' selected="selected"' : '';
974 - echo "\t<option value='{$value}'{$selected}>{$date}</option>\n";
975 -}
976 -?>
977 -</select></td>
978 -</tr>
979 -<!--20101208ysk end-->
980 -<tr>
981 -<td class="label"><?php _e('delivery time', 'usces'); ?></td>
982 -<td class="col1">
983 -<select name="offer[delivery_time]" id="delivery_time_select">
984 - <option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>
985 -</select>
986 -</td>
987 -</tr>
988 -<tr>
989 -<td class="label"><?php _e('Shipping date', 'usces'); ?></td>
990 -<td class="col1"><select name="offer[delidue_date]">
991 - <option value="#none#"><?php _e('Not notified', 'usces'); ?></option>
992 -<?php
993 -for ($i=0; $i<50; $i++) {
994 - $value = date('Y-m-d', mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
995 - $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
996 - $selected = (isset($data['order_delidue_date']) && $data['order_delidue_date'] == $value) ? ' selected="selected"' : '';
997 - echo "\t<option value='{$value}'{$selected}>{$date}</option>\n";
998 -}
999 -?>
1000 -</select></td>
1001 -</tr>
1002 -<tr>
1003 -<td colspan="2" class="midasi3"><?php _e('Status', 'usces'); ?></td>
1004 -</tr>
1005 -<tr>
1006 -<td class="label status"><?php _e('The correspondence situation', 'usces'); ?></td>
1007 -<td class="col1 status">
1008 -<select name="offer[taio]" id="order_taio">
1009 - <option value='#none#'><?php _e('new order', 'usces'); ?></option>
1010 -<?php
1011 - foreach ($management_status as $status_key => $status_name){
1012 - if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
1013 - continue;
1014 -?>
1015 - <option value="<?php echo $status_key; ?>"<?php if($taio == $status_key){ echo ' selected="selected"';} ?>><?php echo $status_name; ?></option>
1016 -<?php
1017 - }
1018 -?>
1019 -</select></td>
1020 -</tr>
1021 -<tr>
1022 -<td class="label status" id="receiptlabel"><?php if($receipt != ''){echo __('transfer statement', 'usces');}else{echo '&nbsp';} ?></td>
1023 -<td class="col1 status" id="receiptbox">
1024 -<?php if($receipt != '') : ?>
1025 -<select name="offer[receipt]">
1026 - <option value='noreceipt'<?php if($receipt == 'noreceipt'){ echo ' selected="selected"';} ?>><?php echo $management_status['noreceipt']; ?></option>
1027 - <option value='receipted'<?php if($receipt == 'receipted'){ echo ' selected="selected"';} ?>><?php echo $management_status['receipted']; ?></option>
1028 - <option value='pending'<?php if($receipt == 'pending'){ echo ' selected="selected"';} ?>><?php echo $management_status['pending']; ?></option>
1029 -</select>
1030 -<?php else : ?>
1031 -&nbsp
1032 -<?php endif; ?>
1033 -</td>
1034 -</tr>
1035 -<tr>
1036 -<td class="label status"><?php if($admin != ''){echo __('estimate order', 'usces');}else{echo '&nbsp';} ?></td>
1037 -<td class="col1 status">
1038 -<?php if($admin != '') : ?>
1039 -<select name="offer[admin]">
1040 - <option value='adminorder'<?php if($admin == 'adminorder'){ echo 'selected="selected"';} ?>><?php echo $management_status['adminorder']; ?></option>
1041 - <option value='estimate'<?php if($admin == 'estimate'){ echo 'selected="selected"';} ?>><?php echo $management_status['estimate']; ?></option>
1042 -</select>
1043 -<?php else : ?>
1044 -&nbsp
1045 -<?php endif; ?></td>
1046 -</tr>
1047 -<tr>
1048 -<td colspan="2" class="status">
1049 -<div class="midasi2"><?php if($condition['display_mode'] == 'Usualsale'){echo __('normal sale', 'usces');}elseif($condition['display_mode'] == 'Promotionsale'){echo __('Sale Campaign', 'usces');} ?></div>
1050 -<div class="condition">
1051 -<?php if ( $condition['display_mode'] == 'Promotionsale' ) : ?>
1052 -<span><?php _e('Special Benefits', 'usces'); ?> : </span><?php echo $condition["campaign_privilege"]; ?> (<?php if($condition["campaign_privilege"] == 'discount'){echo esc_html($condition["privilege_discount"]).__('% Discount', 'usces');}elseif($condition["campaign_privilege"] == 'point'){echo esc_html($condition["privilege_point"]).__(" times (limited to members)", 'usces');} ?>) <br />
1053 -<span><?php _e('applied material', 'usces'); ?> : </span><?php if( !isset($condition["campaign_category"]) || $condition["campaign_category"] == 0){echo __('all the items', 'usces');} else {echo esc_html(get_cat_name($condition["campaign_category"]));} ?><br />
1054 -<?php endif; ?>
1055 -</div></td>
1056 -<td class="label"><?php _e('Notes', 'usces'); ?></td>
1057 -<td colspan="3"><textarea name="offer[note]"><?php echo esc_attr(isset($data['order_note']) ? $data['order_note'] : ''); ?></textarea></td>
1058 -</tr>
1059 -</table>
1060 -</div>
1061 -<?php //if( $this->has_order_custom_info( $order_id ) ): ?>
1062 -<div class="info_head">
1063 -<table>
1064 -<tr>
1065 -<td class="midasi0"><?php _e('Custom order field', 'usces'); ?></td>
1066 -<td class="midasi0"><?php _e('Payment information', 'usces'); ?></td>
1067 -</tr>
1068 -<tr>
1069 -<td class="wrap_td">
1070 -<table class="order_custom_wrap">
1071 -<tr>
1072 -<?php do_action( 'usces_action_order_edit_form_custom', $data ); ?>
1073 -<?php
1074 -//20100818ysk start
1075 -usces_admin_custom_field_input($csod_meta, 'order', '');
1076 -//20100818ysk end
1077 -?>
1078 -</tr>
1079 -
1080 -</table>
1081 -</td>
1082 -<td class="wrap_td">
1083 -<table class="settle_info_wrap">
1084 -<?php usces_settle_info_field( $order_id, 'tr' ); ?>
1085 -</table>
1086 -</td>
1087 -</tr>
1088 -</table>
1089 -</div>
1090 -<?php //endif; ?>
1091 -<div id="cart">
1092 -<table cellspacing="0" id="cart_table">
1093 - <thead>
1094 - <tr>
1095 - <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1096 - <th id="total_full_top" class="aright">&nbsp;</th>
1097 - <th colspan="2">&nbsp;<?php _e('Currency','usces'); ?>(<?php usces_crcode(); ?>)</th>
1098 - </tr>
1099 - <tr>
1100 - <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
1101 - <th class="thumbnail"> <?php //echo __('thumbnail','usces'); ?></th>
1102 - <th><?php _e('Items','usces'); ?></th>
1103 - <th class="price"><?php _e('Unit price','usces'); ?></th>
1104 - <th class="quantity"><?php _e('Quantity','usces'); ?></th>
1105 - <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
1106 - <th class="stock"><?php _e('Current stock', 'usces'); ?></th>
1107 - <th class="action"><input name="addButton" id="addCartButton" class="addCartButton" type="button" value="<?php _e('Add item', 'usces'); ?>" /></th>
1108 - </tr>
1109 - </thead>
1110 - <tbody id="orderitemlist">
1111 -<?php
1112 - global $post;
1113 - for($i=0; $i<count($cart); $i++) {
1114 - $cart_row = $cart[$i];
1115 - $post_id = $cart_row['post_id'];
1116 - $post = get_post($post_id);
1117 - $sku = $cart_row['sku'];
1118 - $sku_code = esc_attr(urldecode($cart_row['sku']));
1119 - $quantity = $cart_row['quantity'];
1120 - $options = $cart_row['options'];
1121 - $advance = $this->cart->wc_serialize($cart_row['advance']);
1122 - $itemCode = $this->getItemCode($post_id);
1123 - $itemName = $this->getItemName($post_id);
1124 - $cartItemName = $this->getCartItemName($post_id, $sku_code);
1125 - $skuPrice = $cart_row['price'];
1126 - $stock = $this->getItemZaiko($post_id, $sku_code);
1127 - $red = (in_array($stock, array(__('sellout', 'usces'), __('Out Of Stock', 'usces'), __('Out of print', 'usces')))) ? 'class="signal_red"' : '';
1128 - $pictid = (int)$this->get_mainpictid($itemCode);
1129 - if( empty($options) ) {
1130 - $optstr = '';
1131 - $options = array();
1132 - }
1133 - if( is_array($options) && count($options) > 0 ){
1134 - $optstr = '';
1135 - foreach($options as $key => $value){
1136 -//20110629ysk start 0000190
1137 - //if( !empty($key) )
1138 - // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1139 - if( !empty($key) ) {
1140 - $key = urldecode($key);
1141 - if(is_array($value)) {
1142 - $c = '';
1143 - $optstr .= esc_html($key) . ' : ';
1144 - foreach($value as $v) {
1145 - $optstr .= $c.nl2br(esc_html(urldecode($v)));
1146 - $c = ', ';
1147 - }
1148 - $optstr .= "<br />\n";
1149 - } else {
1150 - $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1151 - }
1152 - }
1153 -//20110629ysk end
1154 - }
1155 - }
1156 - $materials = compact('i', 'cart_row', 'post_id', 'sku', 'sku_code', 'quantity', 'options', 'advance',
1157 - 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'stock', 'red', 'pictid');
1158 - $optstr = apply_filters( 'usces_filter_order_edit_form_row', $optstr, $cart, $materials );
1159 -?>
1160 - <tr>
1161 - <td><?php echo $i + 1; ?></td>
1162 - <td><?php echo wp_get_attachment_image( $pictid, array(150, 150), true ); ?></td>
1163 - <td class="aleft"><?php echo esc_html($cartItemName); ?><?php do_action('usces_admin_order_item_name', $order_id, $i); ?><br /><?php echo $optstr; ?></td>
1164 - <td><input name="skuPrice[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="text price" type="text" value="<?php echo esc_attr( $skuPrice ); ?>" /></td>
1165 - <td><input name="quant[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="text quantity" type="text" value="<?php echo esc_attr($cart_row['quantity']); ?>" /></td>
1166 - <td id="sub_total[<?php echo $i; ?>]" class="aright">&nbsp;</td>
1167 - <td <?php echo $red ?>><?php echo esc_html($stock); ?></td>
1168 - <td>
1169 - <?php foreach((array)$options as $key => $value){ ?>
1170 - <input name="optName[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo esc_attr($key); ?>" />
1171 - <?php if(is_array($value)): //20110715ysk 0000202 ?>
1172 - <?php foreach($value as $v): ?>
1173 - <input name="itemOption[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>][<?php echo $v; ?>]" type="hidden" value="<?php echo $v; ?>" />
1174 - <?php endforeach; ?>
1175 - <?php else: ?>
1176 - <input name="itemOption[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo $value; ?>" />
1177 - <?php endif; ?>
1178 - <?php } ?>
1179 - <input name="advance[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" type="hidden" value="<?php echo esc_attr($advance); ?>" />
1180 - <input name="delButton[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="delCartButton" type="submit" value="<?php _e('Delete', 'usces'); ?>" />
1181 - <?php do_action('usces_admin_order_cart_button', $order_id, $i); ?>
1182 - </td>
1183 - </tr>
1184 -<?php
1185 - }
1186 -?>
1187 - </tbody>
1188 - <tfoot>
1189 - <tr>
1190 - <th colspan="5" class="aright"><?php _e('total items','usces'); ?></th>
1191 - <th id="item_total" class="aright">&nbsp;</th>
1192 - <th colspan="2">&nbsp;</th>
1193 - </tr>
1194 - <tr>
1195 - <td colspan="5" class="aright"><?php _e('Used points','usces'); ?></td>
1196 - <td class="aright" style="color:#FF0000"><input name="offer[usedpoint]" id="order_usedpoint" class="text price red" type="text" value="<?php if( isset($data['order_usedpoint']) && !empty($data['order_usedpoint']) ) {echo esc_attr($data['order_usedpoint']); } else { echo '0'; } ?>" /></td>
1197 - <td><?php _e('granted points', 'usces'); ?></td>
1198 - <td class="aright" style="color:#FF0000"><input name="offer[getpoint]" id="order_getpoint" class="text price" type="text" value="<?php if( isset($data['order_getpoint']) && !empty($data['order_getpoint']) ) {echo esc_attr($data['order_getpoint']); } else { echo '0'; } ?>" /></td>
1199 - </tr>
1200 - <tr>
1201 - <td colspan="5" class="aright"><?php echo apply_filters('usces_confirm_discount_label', __('Campaign disnount', 'usces'), $order_id); ?></td>
1202 - <td class="aright" style="color:#FF0000"><input name="offer[discount]" id="order_discount" class="text price" type="text" value="<?php if( isset($data['order_discount']) && !empty($data['order_discount']) ) { usces_crform( $data['order_discount'], false, false, '', false ); } else { echo '0'; } ?>" /></td>
1203 - <td colspan="2"><?php _e('Discounted amount should be shown by -(Minus)', 'usces'); ?>&nbsp;</td>
1204 - </tr>
1205 - <tr>
1206 - <td colspan="5" class="aright"><?php _e('Shipping', 'usces'); ?></td>
1207 - <td class="aright"><input name="offer[shipping_charge]" id="order_shipping_charge" class="text price" type="text" value="<?php if( isset($data['order_shipping_charge']) && !empty($data['order_shipping_charge']) ) { usces_crform( $data['order_shipping_charge'], false, false, '', false ); } else { echo '0'; } ?>" /></td>
1208 - <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1209 - </tr>
1210 - <tr>
1211 - <td colspan="5" class="aright"><?php echo apply_filters('usces_filter_cod_label', __('COD fee', 'usces')); ?></td>
1212 - <td class="aright"><input name="offer[cod_fee]" id="order_cod_fee" class="text price" type="text" value="<?php if( isset($data['order_cod_fee']) && !empty($data['order_cod_fee']) ) { usces_crform( $data['order_cod_fee'], false, false, '', false ); } else { echo '0'; } ?>" /></td>
1213 - <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1214 - </tr>
1215 - <tr>
1216 - <td colspan="5" class="aright"><?php _e('consumption tax', 'usces'); ?></td>
1217 - <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php if( isset($data['order_tax']) && !empty($data['order_tax']) ) { usces_crform( $data['order_tax'], false, false, '', false ); } else { echo '0'; } ?>" /></td>
1218 - <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1219 - </tr>
1220 - <tr>
1221 - <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1222 - <th id="total_full" class="aright">&nbsp;</th>
1223 - <th colspan="2"><input name="recalc" id="recalc" class="addCartButton" type="button" value="<?php _e('再計算', 'usces'); ?>" /></th>
1224 - </tr>
1225 - </tfoot>
1226 -</table>
1227 -</div>
1228 -<div class="ordernavi"><input name="upButton2" class="upButton" type="submit" value="<?php _e('change decision', 'usces'); ?>" /><?php _e("When you change amount, please click 'Edit' before you finish your process.", 'usces'); ?></div>
1229 -
1230 -<input name="order_action" type="hidden" value="<?php echo $oa; ?>" />
1231 -<input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr(isset($data['ID']) ? $data['ID'] : ''); ?>" />
1232 -<input name="old_getpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_getpoint']) ? $data['order_getpoint'] : ''); ?>" />
1233 -<input name="old_usedpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_usedpoint']) ? $data['order_usedpoint'] : ''); ?>" />
1234 -<input name="up_modified" id="up_modified" type="hidden" value="" />
1235 -<input name="modified" id="modified" type="hidden" value="<?php echo esc_attr(isset($data['order_modified']) ? $data['order_modified'] : ''); ?>" />
1236 -
1237 -
1238 -
1239 -
1240 -<div id="addItemDialog" title="<?php _e('Add item', 'usces'); ?>">
1241 - <div id="order-response"></div>
1242 - <fieldset>
1243 - <div class="clearfix">
1244 - <div class="dialogsearch">
1245 - <p><?php _e("Enter the item code, then press 'Obtain'", 'usces'); ?></p>
1246 - <label for="name"><?php _e('item code', 'usces'); ?></label>
1247 - <input type="text" name="newitemcode" id="newitemcode" class="text" />
1248 - <input name="getitem" type="button" value="<?php _e('Obtain', 'usces'); ?>" onclick="if( jQuery('#newitemcode').val() == '' ) return; orderItem.getitem();" />
1249 - </div>
1250 - <div id="newitemform"></div>
1251 - </div>
1252 - </fieldset>
1253 -</div>
1254 -
1255 -
1256 -
1257 -<div id="mailSendDialog" title="">
1258 - <div id="order-response"></div>
1259 - <fieldset>
1260 - <p><?php _e("Check the mail and click 'send'", 'usces'); ?></p>
1261 - <label><?php _e('e-mail adress', 'usces'); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
1262 - <label><?php _e('Client name', 'usces'); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
1263 - <label><?php _e('subject', 'usces'); ?></label><input type="text" name="sendmailsubject" id="sendmailsubject" class="text" /><input name="sendmail" id="sendmail" type="button" value="<?php _e('send', 'usces'); ?>" /><br />
1264 - <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
1265 - <input name="mailChecked" id="mailChecked" type="hidden" />
1266 - </fieldset>
1267 -</div>
1268 -
1269 -<div id="mailSendAlert" title="">
1270 - <div id="order-response"></div>
1271 - <fieldset>
1272 - </fieldset>
1273 -</div>
1274 -<input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
1275 -</form>
1276 -
1277 -<div id="PDFDialog" title="">
1278 - <div id="pdf_response"></div>
1279 - <fieldset>
1280 - <div id="new_pdf"></div>
1281 - </fieldset>
1282 -</div>
1283 -
1284 -</div><!--usces_admin-->
1285 -</div><!--wrap-->
1 +<?php
2 +/**
3 + * Order Edit Screen
4 + *
5 + * @package Welcart
6 + */
7 +
8 +if ( ! current_user_can( 'wel_manage_order' ) ) {
9 + wp_die( __( 'You do not have sufficient privileges to perform this operation.', 'usces' ) );
10 +}
11 +if ( ! ( isset( $_GET['page'] ) && 'usces_ordernew' === $_GET['page'] ) ) {
12 + check_admin_referer( 'order_edit', 'wc_nonce' );
13 +}
14 +
15 +$pname = array();
16 +$payment_method = array();
17 +$csod_meta = array();
18 +$usces_tax = Welcart_Tax::get_instance();
19 +
20 +$add_html_email_option = (int) $this->options['add_html_email_option'];
21 +$management_status = apply_filters( 'usces_filter_management_status', get_option( 'usces_management_status' ) );
22 +$payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
23 +
24 +foreach ( $payment_method as $pmet ) {
25 + $pname[] = $pmet['name'];
26 +}
27 +if ( ! in_array( __( 'Transfer (prepayment)', 'usces' ), $pname, true ) ) {
28 + $newp['name'] = __( 'Transfer (prepayment)', 'usces' );
29 + $newp['explanation'] = '';
30 + $newp['settlement'] = 'transferAdvance';
31 + $newp['module'] = '';
32 + $payment_method[] = $newp;
33 +}
34 +if ( ! in_array( __( 'Transfer (postpay)', 'usces' ), $pname, true ) ) {
35 + $newp['name'] = __( 'Transfer (postpay)', 'usces' );
36 + $newp['explanation'] = '';
37 + $newp['settlement'] = 'transferDeferred';
38 + $newp['module'] = '';
39 + $payment_method[] = $newp;
40 +}
41 +if ( ! in_array( __( 'COD', 'usces' ), $pname, true ) ) {
42 + $newp['name'] = __( 'COD', 'usces' );
43 + $newp['explanation'] = '';
44 + $newp['settlement'] = 'COD';
45 + $newp['module'] = '';
46 + $payment_method[] = $newp;
47 +}
48 +
49 +if ( 'new' === $order_action ) {
50 +
51 + $oa = 'newpost';
52 + $taio = 'new';
53 + $admin = 'adminorder';
54 + $receipt = '';
55 + $ordercheck = array();
56 + $order_delivery_method = -1;
57 + $order_id = null;
58 +
59 + $csod_meta = usces_has_custom_field_meta( 'order' );
60 + if ( is_array( $csod_meta ) ) {
61 + $keys = array_keys( $csod_meta );
62 + foreach ( $keys as $key ) {
63 + $csod_key = 'csod_' . $key;
64 +
65 + $csod_meta[ $key ]['data'] = null;
66 + }
67 + }
68 + $cscs_meta = usces_has_custom_field_meta( 'customer' );
69 + if ( is_array( $cscs_meta ) ) {
70 + $keys = array_keys( $cscs_meta );
71 + foreach ( $keys as $key ) {
72 + $cscs_key = 'cscs_' . $key;
73 +
74 + $cscs_meta[ $key ]['data'] = null;
75 + }
76 + }
77 + $csde_meta = usces_has_custom_field_meta( 'delivery' );
78 + if ( is_array( $csde_meta ) ) {
79 + $keys = array_keys( $csde_meta );
80 + foreach ( $keys as $key ) {
81 + $csde_key = 'csde_' . $key;
82 +
83 + $csde_meta[ $key ]['data'] = null;
84 + }
85 + }
86 +
87 + $condition = $this->get_condition();
88 +
89 + $data = array(
90 + 'mem_name1' => '',
91 + 'mem_name2' => '',
92 + 'mem_name3' => '',
93 + 'mem_name4' => '',
94 + 'mem_zip' => '',
95 + 'mem_address1' => '',
96 + 'mem_address2' => '',
97 + 'mem_address3' => '',
98 + 'mem_tel' => '',
99 + 'mem_fax' => '',
100 + 'mem_country' => '',
101 + 'mem_pref' => '',
102 + 'order_name1' => '',
103 + 'order_name2' => '',
104 + 'order_name3' => '',
105 + 'order_name4' => '',
106 + 'order_zip' => '',
107 + 'order_address1' => '',
108 + 'order_address2' => '',
109 + 'order_address3' => '',
110 + 'order_tel' => '',
111 + 'order_fax' => '',
112 + 'order_country' => '',
113 + 'order_pref' => '',
114 + 'ID' => '',
115 + 'order_condition' => $condition,
116 + 'order_date' => current_time( 'mysql' ),
117 + 'order_delivery_date' => '',
118 + );
119 + $deli = array(
120 + 'name1' => '',
121 + 'name2' => '',
122 + 'name3' => '',
123 + 'name4' => '',
124 + 'zipcode' => '',
125 + 'address1' => '',
126 + 'address2' => '',
127 + 'address3' => '',
128 + 'tel' => '',
129 + 'fax' => '',
130 + 'country' => '',
131 + 'pref' => '',
132 + );
133 +
134 + $cart = array();
135 + $navibutton = '';
136 +
137 + $order_subtotal_standard = 0;
138 + $order_subtotal_reduced = 0;
139 + $order_discount_standard = 0;
140 + $order_discount_reduced = 0;
141 + $include_tax = '';
142 + $include_tax_standard = '';
143 + $include_tax_reduced = '';
144 + $tax_target = usces_get_tax_target();
145 + $tax_mode = usces_get_tax_mode();
146 + $reduced_taxrate = $this->is_reduced_taxrate();
147 + $tax_readonly = ( 'include' === $tax_mode ) ? ' readonly' : '';
148 + $change_taxrate = '';
149 + $tax_label = ( 'exclude' === $tax_mode ) ? __( 'consumption tax', 'usces' ) : __( 'Internal tax', 'usces' );
150 + $mem_point = 0;
151 +
152 +} else {
153 +
154 + $oa = 'editpost';
155 +
156 + $order_id = isset( $_REQUEST['order_id'] ) ? (int) wp_kses( wp_unslash( $_REQUEST['order_id'] ), array() ) : 0;
157 + $data = $this->get_order_data( $order_id, 'direct' );
158 +
159 + $deli = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_delivery'] ) );
160 + $seriarized_cart = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_cart'] ) );
161 + $cart = usces_get_ordercartdata( $order_id );
162 + $condition = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_condition'] ) );
163 + $ordercheck = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_check'] ) );
164 +
165 + if ( ! is_array( $ordercheck ) ) {
166 + $ordercheck = array();
167 + }
168 +
169 + $order_delivery_method = $data['order_delivery_method'];
170 +
171 + if ( ! empty( $data ) ) {
172 + $data = stripslashes_deep( $data );
173 + }
174 +
175 + $exclusion_status = apply_filters( 'usces_filter_taio_exclusion_status', array( 'noreceipt', 'receipted', 'pending', 'estimate', 'adminorder' ) );
176 + foreach ( $management_status as $status_key => $status_name ) {
177 + if ( in_array( $status_key, $exclusion_status, true ) ) {
178 + continue;
179 + }
180 +
181 + if ( $this->is_status( $status_key, $data['order_status'] ) ) {
182 + $taio = $status_key;
183 + break;
184 + } else {
185 + $taio = 'new';
186 + }
187 + }
188 +
189 + if ( $this->is_status( 'estimate', $data['order_status'] ) ) {
190 + $admin = 'estimate';
191 + } elseif ( $this->is_status( 'adminorder', $data['order_status'] ) ) {
192 + $admin = 'adminorder';
193 + } else {
194 + $admin = '';
195 + }
196 +
197 + if ( $this->is_status( 'noreceipt', $data['order_status'] ) ) {
198 + $receipt = 'noreceipt';
199 + } elseif ( $this->is_status( 'receipted', $data['order_status'] ) ) {
200 + $receipt = 'receipted';
201 + } elseif ( $this->is_status( 'pending', $data['order_status'] ) ) {
202 + $receipt = 'pending';
203 + } else {
204 + $receipt = '';
205 + }
206 +
207 + $csod_meta = usces_has_custom_field_meta( 'order' );
208 + if ( is_array( $csod_meta ) ) {
209 + $keys = array_keys( $csod_meta );
210 + foreach ( $keys as $key ) {
211 + $csod_key = 'csod_' . $key;
212 + $csod_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $csod_key, $order_id ) );
213 + }
214 + }
215 + // Start - Display data of the deleted order custom fields.
216 + global $wpdb;
217 + $deleted_csod_meta_display = '';
218 + $order_meta_table = $wpdb->prefix . 'usces_order_meta';
219 + $query = $wpdb->prepare(
220 + "SELECT * FROM {$order_meta_table} WHERE order_id = %d AND meta_key LIKE 'csod_%'",
221 + $order_id
222 + );
223 + $order_meta_data = $wpdb->get_results( $query, ARRAY_A );
224 + if ( ! empty( $order_meta_data ) ) {
225 + foreach ( $order_meta_data as $order_meta ) {
226 + $order_meta_key = str_replace( 'csod_', '', $order_meta['meta_key'] );
227 + $deleted = ! isset( $csod_meta[ $order_meta_key ] );
228 + if ( $deleted ) {
229 + $display_order_meta = wel_safe_maybe_unserialize( $order_meta['meta_value'] );
230 + if ( is_array( $display_order_meta ) ) {
231 + $display_order_meta = implode( ',', $display_order_meta );
232 + }
233 + $deleted_csod_meta_display .= '<tr><td class="label">' . esc_html( $order_meta_key ) . '</td><td>' . esc_html( $display_order_meta ) . '</td></tr>';
234 + }
235 + }
236 + }
237 + // End - Display data of the deleted order custom fields.
238 + $cscs_meta = usces_has_custom_field_meta( 'customer' );
239 + if ( is_array( $cscs_meta ) ) {
240 + $keys = array_keys( $cscs_meta );
241 + foreach ( $keys as $key ) {
242 + $cscs_key = 'cscs_' . $key;
243 + $cscs_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $cscs_key, $order_id ) );
244 + }
245 + }
246 + $csde_meta = usces_has_custom_field_meta( 'delivery' );
247 + if ( is_array( $csde_meta ) ) {
248 + $keys = array_keys( $csde_meta );
249 + foreach ( $keys as $key ) {
250 + $csde_key = 'csde_' . $key;
251 + $csde_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $csde_key, $order_id ) );
252 + }
253 + }
254 +
255 + $exopt = get_option( 'usces_ex', array() );
256 + if ( isset( $exopt['system']['datalistup']['orderlist_flag'] ) && $exopt['system']['datalistup']['orderlist_flag'] ) {
257 + $navibutton = '';
258 + $navibutton .= '<a href="javascript:;" class="prev-page" style="display:none"><span class="dashicons dashicons-arrow-left-alt2"></span>' . __( 'to prev page', 'usces' ) . '</a>';
259 + $navibutton .= '<a href="' . admin_url( 'admin.php?page=usces_orderlist&returnList=1&wc_nonce=' . wp_create_nonce( 'order_list' ) ) . '" class="back-list"><span class="dashicons dashicons-list-view"></span>' . __( 'to order list', 'usces' ) . '</a>';
260 + $navibutton .= '<a href="javascript:;" class="next-page" style="display:none">' . __( 'to next page', 'usces' ) . '<span class="dashicons dashicons-arrow-right-alt2"></span></a>';
261 + } else {
262 + $navibutton = '<a href="' . admin_url( 'admin.php?page=usces_orderlist&returnList=1&wc_nonce=' . wp_create_nonce( 'order_list' ) ) . '" class="back-list"><span class="dashicons dashicons-list-view"></span>' . __( 'to order list', 'usces' ) . '</a>';
263 + }
264 +
265 + $order_subtotal_standard = 0;
266 + $order_subtotal_reduced = 0;
267 + $order_discount_standard = 0;
268 + $order_discount_reduced = 0;
269 + $include_tax = '';
270 + $include_tax_standard = '';
271 + $include_tax_reduced = '';
272 +
273 + $tax_target = ( isset( $condition['tax_target'] ) ) ? $condition['tax_target'] : $this->options['tax_target'];
274 + $tax_mode = ( isset( $condition['tax_mode'] ) ) ? $condition['tax_mode'] : $this->options['tax_mode'];
275 + $tax_label = ( 'exclude' === $tax_mode ) ? __( 'consumption tax', 'usces' ) : __( 'Internal tax', 'usces' );
276 +
277 + $reduced_taxrate = ( isset( $condition['applicable_taxrate'] ) && 'reduced' === $condition['applicable_taxrate'] ) ? true : false;
278 + if ( $reduced_taxrate ) {
279 + $materials = array(
280 + 'total_items_price' => $data['order_item_total_price'],
281 + 'discount' => $data['order_discount'],
282 + 'shipping_charge' => $data['order_shipping_charge'],
283 + 'cod_fee' => $data['order_cod_fee'],
284 + 'use_point' => $data['order_usedpoint'],
285 + 'carts' => $cart,
286 + 'condition' => $condition,
287 + 'order_id' => $order_id,
288 + );
289 + $usces_tax->get_order_tax( $materials );
290 + $order_subtotal_standard = $usces_tax->subtotal_standard;
291 + $order_subtotal_reduced = $usces_tax->subtotal_reduced;
292 + $order_discount_standard = $usces_tax->discount_standard;
293 + $order_discount_reduced = $usces_tax->discount_reduced;
294 + if ( 'exclude' === $tax_mode ) {
295 + $order_tax_standard = $usces_tax->tax_standard;
296 + $order_tax_reduced = $usces_tax->tax_reduced;
297 + }
298 + }
299 + if ( 'include' === $tax_mode ) {
300 + if ( $reduced_taxrate ) {
301 + $include_tax_standard = '(' . usces_crform( $usces_tax->tax_standard, false, false, 'return', true ) . ')';
302 + $include_tax_reduced = '(' . usces_crform( $usces_tax->tax_reduced, false, false, 'return', true ) . ')';
303 + $include_tax = '(' . usces_crform( $usces_tax->tax_standard + $usces_tax->tax_reduced, false, false, 'return', true ) . ')';
304 + } else {
305 + $materials = array(
306 + 'total_items_price' => $data['order_item_total_price'],
307 + 'discount' => $data['order_discount'],
308 + 'shipping_charge' => $data['order_shipping_charge'],
309 + 'cod_fee' => $data['order_cod_fee'],
310 + 'use_point' => $data['order_usedpoint'],
311 + 'condition' => $condition,
312 + );
313 +
314 + $include_tax = '(' . usces_crform( usces_internal_tax( $materials, 'return' ), false, false, 'return', true ) . ')';
315 + }
316 + }
317 + $tax_readonly = ( 'include' === $tax_mode ) ? ' readonly' : '';
318 + $change_taxrate = '<span><label><input type="checkbox" name="change_taxrate" id="change_taxrate" value="change">' . __( 'Apply the changed tax rate', 'usces' ) . '</label></span>';
319 +
320 + if ( isset( $data['mem_id'] ) ) {
321 + $member_info = $this->get_member_info( $data['mem_id'] );
322 + $mem_point = ( isset( $member_info['mem_point'] ) ) ? (int) $member_info['mem_point'] : 0;
323 + } else {
324 + $mem_point = 0;
325 + }
326 +}
327 +
328 +$delivery_after_days = apply_filters( 'usces_filter_delivery_after_days', ( ! empty( $this->options['delivery_after_days'] ) ? (int) $this->options['delivery_after_days'] : 100 ) );
329 +$delivery_date = ( isset( $data['order_delivery_date'] ) && usces_is_date( $data['order_delivery_date'] ) ) ? $data['order_delivery_date'] : '';
330 +$delidue_date = ( isset( $data['order_delidue_date'] ) && usces_is_date( $data['order_delidue_date'] ) ) ? $data['order_delidue_date'] : '';
331 +$order_date_time = explode( ' ', $data['order_date'] );
332 +$order_date = explode( '-', $order_date_time[0] );
333 +$order_yy = (int) $order_date[0];
334 +$order_mm = (int) $order_date[1] - 1;
335 +$order_dd = (int) $order_date[2];
336 +
337 +$noreceipt_status = apply_filters( 'usces_filter_noreceipt_status', get_option( 'usces_noreceipt_status' ) );
338 +$filter_args = compact( 'order_action', 'order_id', 'data', 'cart' );
339 +$action_args = compact( 'order_action', 'order_id', 'cart' );
340 +
341 +$payments_str = '';
342 +$payments = usces_get_system_option( 'usces_payment_method', 'sort' );
343 +foreach ( (array) $payments as $array ) {
344 + $payments_str .= "'" . esc_js( $array['name'] ) . "': '" . esc_js( $array['settlement'] ) . "', ";
345 +}
346 +$payments_str .= "'" . __( 'Transfer (prepayment)', 'usces' ) . "': 'transferAdvance', ";
347 +$payments_str .= "'" . __( 'Transfer (postpay)', 'usces' ) . "': 'transferDeferred', ";
348 +$payments_str .= "'" . __( 'COD', 'usces' ) . "': 'COD', ";
349 +$payments_str = rtrim( $payments_str, ', ' );
350 +
351 +$no_preference = apply_filters( 'usces_filter_label_delivery_date_no_preference', __( 'Non-request', 'usces_dual' ) );
352 +
353 +$mailsenddialog_height = ( 1 === $this->options['email_attach_feature'] || 1 === $add_html_email_option ) ? 628 : 578;
354 +$mailsenddialog_width = 700;
355 +$mail_data = usces_mail_data();
356 +
357 +$usedpoint_readonly = ( usces_is_membersystem_point() && ! empty( $data['mem_id'] ) ) ? '' : ' readonly';
358 +$getpoint_readonly = ( usces_is_membersystem_point() ) ? '' : ' readonly';
359 +
360 +$email_attach_file_extension = wel_email_attach_file_extension( explode( ',', strtolower( $this->options['email_attach_file_extension'] ) ) );
361 +?>
362 +<style>
363 + .usces_tablenav #mailVisiLink {
364 + width: auto;
365 + min-width: 190px;
366 + }
367 + #wrap_icon_loading {
368 + display: inline-block;
369 + width: 20px;
370 + height: 20px;
371 + position: relative;
372 + }
373 + #wrap_icon_loading > img {
374 + position: absolute;
375 + top: 10px;
376 + }
377 +</style>
378 +<script type='text/javascript'>
379 +/* <![CDATA[ */
380 + uscesPayments = {<?php echo wp_kses_data( $payments_str ); ?>};
381 +/* ]]> */
382 +</script>
383 +<script type="text/javascript">
384 +jQuery(function($){
385 + var selected_delivery_time = '<?php echo ( isset( $data['order_delivery_time'] ) ? esc_js( $data['order_delivery_time'] ) : '' ); ?>';
386 + var delivery_time = [];
387 + <?php if ( 1 === $add_html_email_option ) { ?>
388 + var usceAdminUrl = '<?php echo esc_url_raw( USCES_ADMIN_URL ); ?>';
389 + <?php } ?>
390 + <?php
391 + foreach ( (array) $this->options['delivery_method'] as $dmid => $dm ) {
392 + $dm['time'] = usces_change_line_break( $dm['time'] );
393 + $lines = explode( "\n", $dm['time'] );
394 + ?>
395 + delivery_time[<?php echo wp_kses_data( $dm['id'] ); ?>] = [];
396 + <?php
397 + foreach ( (array) $lines as $line ) {
398 + if ( trim( $line ) !== '' ) {
399 + ?>
400 + delivery_time[<?php echo wp_kses_data( $dm['id'] ); ?>].push("<?php echo wp_kses_data( trim( $line ) ); ?>");
401 + <?php
402 + }
403 + }
404 + }
405 + ?>
406 +
407 + $("#order_payment_name").change(function () {
408 + var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
409 + var noreceipt_status = [ '<?php echo wp_kses_data( implode( "','", $noreceipt_status ) ); ?>' ];
410 + if( $.inArray( uscesPayments[pay_name], noreceipt_status ) >= 0 ) {
411 + var label = '<?php esc_html_e( 'transfer statement', 'usces' ); ?>';
412 + var html = "<select name='offer[receipt]'>\n";
413 + html += "<option value='noreceipt'><?php echo wp_kses_data( $management_status['noreceipt'] ); ?></option>\n";
414 + html += "<option value='receipted'><?php echo wp_kses_data( $management_status['receipted'] ); ?></option>\n";
415 + html += "</select>\n";
416 + $("#receiptlabel").html(label);
417 + $("#receiptbox").html(html);
418 + <?php do_action( 'usces_change_payment_terms_js', $management_status, $data ); ?>
419 + }else{
420 + $("#receiptlabel").html('');
421 + $("#receiptbox").html('');
422 + }
423 + });
424 +
425 + $("#addItemDialog").dialog({
426 + bgiframe: true,
427 + autoOpen: false,
428 + height: 500,
429 + width: 700,
430 + resizable: true,
431 + modal: true,
432 + appendTo: "#dialog_parent",
433 + buttons: [
434 + {
435 + text: "<?php esc_html_e( 'close', 'usces' ); ?>",
436 + "class": "button",
437 + click: function() {
438 + $(this).dialog('close');
439 + }
440 + }
441 + ],
442 + close: function() {
443 + $("#newitemcategory").val( "-1" );
444 + $("#newitemform").html( "" );
445 + $('#newitemcode').val('');
446 + }
447 + });
448 + $('#addCartButton').click(function() {
449 + if($("input[name='order_id']").val() == ''){
450 + alert("<?php esc_html_e( "Push 'change decision' button, to be settled with an order number.", 'usces' ); ?>");
451 + return;
452 + }
453 + $('#addItemDialog').dialog('open');
454 + });
455 + $('#delivery_method_select').change(function() {
456 + orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
457 + });
458 +
459 + $("#mailSendDialog").dialog({
460 + bgiframe: true,
461 + autoOpen: false,
462 + height: <?php echo wp_kses_data( $mailsenddialog_height ); ?>,
463 + width: <?php echo wp_kses_data( $mailsenddialog_width ); ?>,
464 + resizable: true,
465 + modal: true,
466 + buttons: [
467 + <?php if ( 1 === $add_html_email_option ) { ?>
468 + {
469 + text: "<?php esc_html_e( 'Preview', 'usces' ); ?>",
470 + "class": 'button',
471 + "id": 'usces_email_bnt_preview',
472 + click: function() {
473 + uscesMail.previewMail();
474 + }
475 + },
476 + <?php } ?>
477 + {
478 + text: "<?php esc_html_e( 'send', 'usces' ); ?>",
479 + "class": 'button',
480 + "id": 'usces_email_bnt_send',
481 + click: function() {
482 + uscesMail.sendmail();
483 + }
484 + },
485 + {
486 + text: "<?php esc_html_e( 'close', 'usces' ); ?>",
487 + "class": 'button',
488 + click: function() {
489 + $(this).dialog('close');
490 + }
491 + }
492 + ],
493 + appendTo:"#dialog_parent",
494 + close: function() {
495 + <?php if ( 1 === $add_html_email_option ) { ?>
496 + $('#iframeLoadEditor').attr('src', '');
497 + <?php } else { ?>
498 + $("#sendmailmessage").html( "" );
499 + <?php } ?>
500 + $('#sendmailaddress').val('');
501 + }
502 + });
503 + <?php if ( 1 === $add_html_email_option ) { ?>
504 + $("#previewEmailDialog").dialog({
505 + bgiframe: true,
506 + autoOpen: false,
507 + height: <?php echo wp_kses_data( $mailsenddialog_height ); ?>,
508 + width: <?php echo wp_kses_data( $mailsenddialog_width ); ?>,
509 + resizable: true,
510 + modal: true,
511 + buttons: [
512 + {
513 + text: "<?php esc_html_e( 'close', 'usces' ); ?>",
514 + "class": 'button',
515 + click: function() {
516 + $(this).dialog('close');
517 + }
518 + }
519 + ],
520 + appendTo:"#dialog_parent",
521 + close: function() {
522 + $('#previewEmailDialog').dialog('option', 'title', "");
523 + var dstFrame = document.getElementById('iframePreviewEmail');
524 + var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
525 + dstDoc.write("");
526 + dstDoc.close();
527 + }
528 + });
529 + <?php } ?>
530 + $('#completionMail').click(function() {
531 + var mode = 'completionMail';
532 + <?php if ( 1 === $add_html_email_option ) { ?>
533 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
534 + <?php } else { ?>
535 + orderItem.getmailmessage(mode);
536 + <?php } ?>
537 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
538 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
539 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['completionmail'], $data, 'completionMail' ) ); ?>');
540 + $('#mailChecked').val('completionmail');
541 + $('#sendmailattachfile').val('');
542 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for Shipping', 'usces' ); ?>');
543 + $('#mailSendDialog').dialog('open');
544 + });
545 + $('#orderConfirmMail').click(function() {
546 + var mode = 'orderConfirmMail';
547 + <?php if ( 1 === $add_html_email_option ) { ?>
548 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
549 + <?php } else { ?>
550 + orderItem.getmailmessage(mode);
551 + <?php } ?>
552 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
553 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
554 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['ordermail'], $data, 'orderConfirmMail' ) ); ?>');
555 + $('#mailChecked').val('ordermail');
556 + $('#sendmailattachfile').val('');
557 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confirmation of order', 'usces' ); ?>');
558 + $('#mailSendDialog').dialog('open');
559 + });
560 + $('#changeConfirmMail').click(function() {
561 + var mode = 'changeConfirmMail';
562 + <?php if ( 1 === $add_html_email_option ) { ?>
563 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
564 + <?php } else { ?>
565 + orderItem.getmailmessage(mode);
566 + <?php } ?>
567 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
568 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
569 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['changemail'], $data, 'changeConfirmMail' ) ); ?>');
570 + $('#mailChecked').val('changemail');
571 + $('#sendmailattachfile').val('');
572 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confiemation of change', 'usces' ); ?>');
573 + $('#mailSendDialog').dialog('open');
574 + });
575 + $('#receiptConfirmMail').click(function() {
576 + var mode = 'receiptConfirmMail';
577 + <?php if ( 1 === $add_html_email_option ) { ?>
578 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
579 + <?php } else { ?>
580 + orderItem.getmailmessage(mode);
581 + <?php } ?>
582 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
583 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
584 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['receiptmail'], $data, 'receiptConfirmMail' ) ); ?>');
585 + $('#mailChecked').val('receiptmail');
586 + $('#sendmailattachfile').val('');
587 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confirmation of transter', 'usces' ); ?>');
588 + $('#mailSendDialog').dialog('open');
589 + });
590 + $('#mitumoriConfirmMail').click(function() {
591 + var mode = 'mitumoriConfirmMail';
592 + <?php if ( 1 === $add_html_email_option ) { ?>
593 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
594 + <?php } else { ?>
595 + orderItem.getmailmessage(mode);
596 + <?php } ?>
597 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
598 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
599 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['mitumorimail'], $data, 'mitumoriConfirmMail' ) ); ?>');
600 + $('#mailChecked').val('mitumorimail');
601 + $('#sendmailattachfile').val('');
602 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'estimate mail', 'usces' ); ?>');
603 + $('#mailSendDialog').dialog('open');
604 + });
605 + $('#cancelConfirmMail').click(function() {
606 + var mode = 'cancelConfirmMail';
607 + <?php if ( 1 === $add_html_email_option ) { ?>
608 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
609 + <?php } else { ?>
610 + orderItem.getmailmessage(mode);
611 + <?php } ?>
612 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
613 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
614 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['cancelmail'], $data, 'cancelConfirmMail' ) ); ?>');
615 + $('#mailChecked').val('cancelmail');
616 + $('#sendmailattachfile').val('');
617 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Cancelling mail', 'usces' ); ?>');
618 + $('#mailSendDialog').dialog('open');
619 + });
620 + $('#otherConfirmMail').click(function() {
621 + var mode = 'otherConfirmMail';
622 + <?php if ( 1 === $add_html_email_option ) { ?>
623 + orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
624 + <?php } else { ?>
625 + orderItem.getmailmessage(mode);
626 + <?php } ?>
627 + $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
628 + $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
629 + $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['othermail'], $data, 'otherConfirmMail' ) ); ?>');
630 + $('#mailChecked').val('othermail');
631 + $('#sendmailattachfile').val('');
632 + $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Other mail', 'usces' ); ?>');
633 + $('#mailSendDialog').dialog('open');
634 + });
635 +
636 + $("#mailSendAlert").dialog({
637 + bgiframe: true,
638 + autoOpen: false,
639 + height: 200,
640 + width: 200,
641 + resizable: false,
642 + appendTo: "#mailSendDialog",
643 + modal: false
644 + });
645 +
646 + $("#PDFDialog").dialog({
647 + bgiframe: true,
648 + autoOpen: false,
649 + height: 800,
650 + width: 700,
651 + resizable: true,
652 + modal: true,
653 + buttons: {
654 + '<?php esc_html_e( 'close', 'usces' ); ?>': function() {
655 + $(this).dialog('close');
656 + }
657 + },
658 + close: function() {
659 + $("#new_pdf").html( "" );
660 + }
661 + });
662 + $('#mitumoriprint').click(function() {
663 + uscesMail.ordercheckpost('mitumoriprint');
664 + window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=mitumori", '_blank');
665 + });
666 + $('#nohinprint').click(function() {
667 + uscesMail.ordercheckpost('nohinprint');
668 + window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=nohin", '_blank');
669 + });
670 + $('#receiptprint').click(function() {
671 + uscesMail.ordercheckpost('receiptprint');
672 + window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=receipt", '_blank');
673 + });
674 + $('#billprint').click(function() {
675 + uscesMail.ordercheckpost('billprint');
676 + window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=bill", '_blank');
677 + });
678 +
679 + orderfunc = {
680 + sumPrice : function(obj) {
681 + if(obj != null) {
682 + if(!checkNumMinus(obj.val())) {
683 + alert('<?php esc_html_e( 'Please enter a numeric value.', 'usces' ); ?>');
684 + obj.focus();
685 + return false;
686 + }
687 + <?php if ( usces_is_membersystem_point() ) : ?>
688 + if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
689 + $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
690 + $(this).css({'background-color': '#FFF'});
691 + });
692 + document.getElementById('order_usedpoint').focus();
693 + return false;
694 + }
695 + <?php endif; ?>
696 + }
697 +
698 + <?php
699 + if ( $reduced_taxrate ) :
700 + ?>
701 + var p = $( "input[name*='skuPrice']" );
702 + var q = $( "input[name*='quant']" );
703 + var t = $( "p[id*='sub_total']" );
704 + var db = $( "input[name*='delButton']" );
705 + var applicable_taxrate = $( "input[name*='applicable_taxrate']" );
706 + var subtotal_standard = 0;
707 + var subtotal_reduced = 0;
708 + var discount_standard = parseFloat( $( "#order_discount_standard" ).val() );
709 + var discount_reduced = parseFloat( $( "#order_discount_reduced" ).val() );
710 + var total_full = 0;
711 + var n = <?php echo wp_kses_data( $this->get_currency_decimal() ); ?>;
712 + var order_usedpoint = $( "#order_usedpoint" ).val()*1;
713 + var order_discount = parseFloat( $( "#order_discount" ).val() );
714 + var order_shipping_charge = parseFloat( $( "#order_shipping_charge" ).val() );
715 + var order_cod_fee = parseFloat( $( "#order_cod_fee" ).val() );
716 + var order_tax = parseFloat( $( "#order_tax" ).val() );
717 +
718 + for( var i = 0; i < p.length; i++ ) {
719 + v = parseFloat( $( p[i] ).val() ) * $( q[i] ).val();
720 + if( 0 < n ) {
721 + v = Math.round( v * Math.pow( 10, n ) ) / Math.pow( 10, n );
722 + }
723 + $( t[i] ).html( addComma( v+'' ) );
724 +
725 + if( 'reduced' == $( applicable_taxrate[i] ).val() ) {
726 + subtotal_reduced += v;
727 + subtotal_reduced = Math.round( subtotal_reduced * Math.pow( 10, n ) ) / Math.pow( 10, n );
728 + } else {
729 + subtotal_standard += v;
730 + subtotal_standard = Math.round( subtotal_standard * Math.pow( 10, n ) ) / Math.pow( 10, n );
731 + }
732 + }
733 + var sub_total = subtotal_standard + subtotal_reduced;
734 + $( "#item_total" ).html( addComma( sub_total + '' ) );
735 + <?php
736 + if ( 'all' === $tax_target ) :
737 + ?>
738 + $( "#subtotal_standard" ).html( addComma( subtotal_standard + discount_standard + order_shipping_charge + order_cod_fee + '' ) );
739 + $( "#order_subtotal_standard" ).val( subtotal_standard + order_shipping_charge + order_cod_fee );
740 + <?php
741 + else :
742 + ?>
743 + $( "#subtotal_standard" ).html( addComma( subtotal_standard + discount_standard + '' ) );
744 + $( "#order_subtotal_standard" ).val( subtotal_standard );
745 + <?php
746 + endif;
747 + ?>
748 + $( "#subtotal_reduced" ).html( addComma( subtotal_reduced + discount_reduced + '' ) );
749 + $( "#order_subtotal_reduced" ).val( subtotal_reduced );
750 + total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
751 + if( 0 < n ) {
752 + total_full = Math.round( total_full * Math.pow( 10, n ) ) / Math.pow( 10, n );
753 + }
754 + $( "#total_full" ).html( addComma( total_full + '' ) );
755 + $( "#total_full_top" ).html( addComma( total_full + '' ) );
756 + <?php
757 + else :
758 + ?>
759 + var p = $("input[name*='skuPrice']");
760 + var q = $("input[name*='quant']");
761 + var t = $("p[id*='sub_total']");
762 + var db = $("input[name*='delButton']");
763 + var sub_total = <?php echo apply_filters( 'order_edit_form_sub_total', 0, $data ); ?>;
764 + var total_full = 0;
765 + var n = <?php echo wp_kses_data( $this->get_currency_decimal() ); ?>;
766 +
767 + for( var i = 0; i < p.length; i++ ) {
768 + v = parseFloat($(p[i]).val()) * $(q[i]).val();
769 + if( 0 < n ) {
770 + v = Math.round( v * Math.pow( 10, n ) ) / Math.pow( 10, n );
771 + }
772 + $(t[i]).html(addComma(v+''));
773 + sub_total += v;
774 + sub_total = Math.round( sub_total * Math.pow( 10, n ) ) / Math.pow( 10, n );
775 + }
776 +
777 + $("#item_total").html(addComma(sub_total+''));
778 + var order_usedpoint = $("#order_usedpoint").val()*1;
779 + var order_discount = parseFloat($("#order_discount").val());
780 + var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
781 + var order_cod_fee = parseFloat($("#order_cod_fee").val());
782 + var order_tax = parseFloat($("#order_tax").val());
783 + total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
784 + if( 0 < n ) {
785 + total_full = Math.round( total_full * Math.pow( 10, n ) ) / Math.pow( 10, n );
786 + }
787 + $("#total_full").html(addComma(total_full+''));
788 + $("#total_full_top").html(addComma(total_full+''));
789 + <?php
790 + endif;
791 + ?>
792 + <?php do_action( 'order_edit_form_sumPrice', $data ); ?>
793 + },
794 + make_delivery_time : function(selected) {
795 + var option = '';
796 + if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
797 + option += '<option value="<?php esc_html_e( 'Non-request', 'usces_dual' ); ?>"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>' + "\n";
798 + }else{
799 + for(var i=0; i<delivery_time[selected].length; i++){
800 + if( delivery_time[selected][i] == selected_delivery_time ) {
801 + option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
802 + }else{
803 + option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
804 + }
805 + }
806 + }
807 + $("#delivery_time_select").html(option);
808 + },
809 + getMember : function( email ) {
810 + var s = orderfunc.settings;
811 + var wc_nonce = $("#wc_nonce").val();
812 + s.url = uscesL10n.requestFile;
813 + s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email) + "&wc_nonce=" + wc_nonce;
814 + $.ajax( s ).done(function( data ){
815 + if(data.status_code === 'ok'){
816 + for (var key in data) {
817 + if ( 'status_code' == key ) {
818 + continue;
819 + }
820 + value = data[key];
821 + if('member_id' == key){
822 + $("#member_id_label").html(value);
823 + $("#member_id").val(value);
824 + continue;
825 + }
826 + if ( $(":input[name='" + key + "']").length ) {
827 + $(":input[name='" + key + "']").val(value);
828 + }
829 + }
830 + }else if(data.status_code === 'none'){
831 + alert( '<?php esc_html_e( 'The relevant membership information does not exist.', 'usces' ); ?>' );
832 + }else{
833 + alert( '<?php esc_html_e( 'Membership information could not be retrieved.', 'usces' ); ?>' );
834 + }
835 + }).fail(function( data ){
836 + alert( '<?php esc_html_e( 'Membership information could not be retrieved.', 'usces' ); ?>' );
837 + });
838 + return false;
839 + },
840 + recalculation : function() {
841 + <?php if ( usces_is_membersystem_point() ) : ?>
842 + if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
843 + $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
844 + $(this).css({'background-color': '#FFF'});
845 + });
846 + document.getElementById('order_usedpoint').focus();
847 + return false;
848 + }
849 + <?php
850 + endif;
851 + if ( $reduced_taxrate ) :
852 + $script = "
853 + var p = $( \"input[name*='skuPrice']\" );
854 + var q = $( \"input[name*='quant']\" );
855 + var pi = $( \"input[name*='postId']\" );
856 + var post_ids = [];
857 + var prices = [];
858 + var quants = [];
859 + var cart_ids = [];
860 + for( var i = 0; i < p.length; i++ ) {
861 + var piname = $( pi[i] ).attr( 'name' );
862 + namestrs = piname.split( '[' );
863 + post_ids.push( $( pi[i] ).val() );
864 + prices.push( parseFloat( $(p[i]).val() ) );
865 + quants.push( $( q[i] ).val() );
866 + cart_ids.push( namestrs[1].replace( /[\]]+$/g, '' ) );
867 + }
868 + var order_usedpoint = $( '#order_usedpoint' ).val()*1;
869 + var order_shipping_charge = parseFloat( $( '#order_shipping_charge' ).val() );
870 + var order_cod_fee = parseFloat( $( '#order_cod_fee' ).val() );
871 + var discount_standard = parseFloat( $( '#order_discount_standard' ).val() );
872 + var discount_reduced = parseFloat( $( '#order_discount_reduced' ).val() );
873 + var change_taxrate = $( \"input[name='change_taxrate']:checked\" ).val();
874 + var s = orderfunc.settings;
875 + s.url = uscesL10n.requestFile;
876 + s.data = {
877 + action: 'order_item_ajax',
878 + mode: 'recalculation_reduced',
879 + wc_nonce: $( '#wc_nonce' ).val(),
880 + order_id: $( '#order_id' ).val(),
881 + mem_id: $( '#member_id_label' ).html(),
882 + post_ids: post_ids,
883 + prices: prices,
884 + quants: quants,
885 + cart_ids: cart_ids,
886 + upoint: order_usedpoint,
887 + shipping_charge: order_shipping_charge,
888 + cod_fee: order_cod_fee,
889 + discount_standard: discount_standard,
890 + discount_reduced: discount_reduced,
891 + change_taxrate: change_taxrate
892 + }
893 + s.dataType = 'json';
894 + $.ajax( s ).done(function( data ) {
895 + if( 'ok' == data.status ) {
896 + //console.log( data );
897 + $( '#order_discount' ).val( data.discount );
898 + $( '#order_tax' ).val( data.tax );
899 + $( '#order_getpoint' ).val( data.point );
900 + $( '#total_full' ).html( addComma( data.total_full_price+'' ) );
901 + $( '#total_full_top' ).html( addComma( data.total_full_price+'' ) );
902 + $( '#subtotal_standard' ).html( addComma( parseFloat( data.subtotal_standard )+parseFloat( data.discount_standard )+'' ) );
903 + $( '#subtotal_reduced' ).html( addComma( parseFloat( data.subtotal_reduced )+parseFloat( data.discount_reduced )+'' ) );
904 + if( 'change' == change_taxrate ) {
905 + $( '#order_discount_standard' ).val( data.discount_standard );
906 + $( '#order_discount_reduced' ).val( data.discount_reduced );
907 + }
908 + $( '#order_subtotal_standard' ).val( data.subtotal_standard );
909 + $( '#order_subtotal_reduced' ).val( data.subtotal_reduced );
910 + if( 0 < data.tax ) {
911 + $( '#order_tax_standard' ).val( data.tax_standard );
912 + $( '#order_tax_reduced' ).val( data.tax_reduced );
913 + } else {
914 + $( '#include_tax_standard' ).html( '(' + addComma( data.tax_standard+'' ) + ')' );
915 + $( '#include_tax_reduced' ).html( '(' + addComma( data.tax_reduced+'' ) + ')' );
916 + $( '#include_tax' ).html( '(' + addComma( data.include_tax+'' ) + ')' );
917 + }
918 + $( \"input[name='change_taxrate']\" ).prop( 'checked', false );
919 + } else {
920 + console.log( data );
921 + //alert( 'ERROR1' );
922 + }
923 + }).fail(function( data ) {
924 + console.log( data );
925 + //alert( 'ERROR2' );
926 + });
927 + return false;";
928 + echo apply_filters( 'order_edit_form_recalculation_reduced', $script, $data );
929 + else :
930 + $script = "
931 + var p = $( \"input[name*='skuPrice']\" );
932 + var q = $( \"input[name*='quant']\" );
933 + var pi = $( \"input[name*='postId']\" );
934 + var post_ids = [];
935 + var prices = [];
936 + var quants = [];
937 + var cart_ids = [];
938 + for( var i = 0; i < p.length; i++ ) {
939 + var piname = $( pi[i] ).attr( 'name' );
940 + namestrs = piname.split( '[' );
941 + post_ids.push( $( pi[i] ).val() );
942 + prices.push( parseFloat( $(p[i]).val() ) );
943 + quants.push( $( q[i] ).val() );
944 + cart_ids.push( namestrs[1].replace( /[\]]+$/g, '' ) );
945 + }
946 + var order_usedpoint = $( '#order_usedpoint' ).val()*1;
947 + var order_shipping_charge = parseFloat( $( '#order_shipping_charge' ).val() );
948 + var order_cod_fee = parseFloat( $( '#order_cod_fee' ).val() );
949 + var order_discount = parseFloat( $( '#order_discount' ).val() );
950 + var change_taxrate = $( \"input[name='change_taxrate']:checked\" ).val();
951 + var s = orderfunc.settings;
952 + s.url = uscesL10n.requestFile;
953 + s.dataType = 'json';
954 + s.data = {
955 + action: 'order_item_ajax',
956 + mode: 'recalculation',
957 + wc_nonce: $( '#wc_nonce' ).val(),
958 + order_id: $( '#order_id' ).val(),
959 + mem_id: $( '#member_id_label' ).html(),
960 + post_ids: post_ids,
961 + prices: prices,
962 + quants: quants,
963 + cart_ids: cart_ids,
964 + upoint: order_usedpoint,
965 + shipping_charge: order_shipping_charge,
966 + cod_fee: order_cod_fee,
967 + discount: order_discount,
968 + change_taxrate: change_taxrate
969 + }
970 + $.ajax( s ).done(function( data ) {
971 + if( 'ok' == data.status ) {
972 + //console.log( data );
973 + if( 'reduced' == data.tax_mode ) {
974 + window.location.reload();
975 + } else {
976 + $( '#order_discount' ).val( data.discount );
977 + $( '#order_tax' ).val( data.tax );
978 + $( '#include_tax' ).html( data.include_tax );
979 + $( '#order_getpoint' ).val( data.point );
980 + $( '#total_full' ).html( addComma( data.total_full_price+'' ) );
981 + $( '#total_full_top' ).html( addComma( data.total_full_price+'' ) );
982 + }
983 + $( \"input[name='change_taxrate']\" ).prop( 'checked', false );
984 + } else {
985 + console.log( data );
986 + //alert( 'ERROR1' );
987 + }
988 + }).fail(function( data ) {
989 + console.log( data );
990 + //alert( 'ERROR2' );
991 + });
992 + return false;";
993 + echo apply_filters( 'order_edit_form_recalculation', $script, $data );
994 + endif;
995 + ?>
996 + },
997 + <?php
998 + if ( $reduced_taxrate ) :
999 + ?>
1000 + sumDiscount : function() {
1001 + if( "" == $( "#order_discount_standard" ).val() || !checkNumMinus( $( "#order_discount_standard" ).val() ) ) {
1002 + $( "#order_discount_standard" ).val( "0" );
1003 + }
1004 + if( "" == $( "#order_discount_reduced" ).val() || !checkNumMinus( $( "#order_discount_reduced" ).val() ) ) {
1005 + $( "#order_discount_reduced" ).val( "0" );
1006 + }
1007 + var n = <?php echo esc_js( $this->get_currency_decimal() ); ?>;
1008 + var order_discount = parseFloat( $( "#order_discount_standard" ).val() ) + parseFloat( $( "#order_discount_reduced" ).val() );
1009 + order_discount = Math.round( order_discount * Math.pow( 10, n ) ) / Math.pow( 10, n );
1010 + $( '#order_discount' ).val( order_discount );
1011 + },
1012 + sumTax : function() {
1013 + if( "" == $( "#order_tax_standard" ).val() || !checkNum( $( "#order_tax_standard" ).val() ) ) {
1014 + $( "#order_tax_standard" ).val( "0" );
1015 + }
1016 + if( "" == $( "#order_tax_reduced" ).val() || !checkNum( $( "#order_tax_reduced" ).val() ) ) {
1017 + $( "#order_tax_reduced" ).val( "0" );
1018 + }
1019 + var n = <?php echo esc_js( $this->get_currency_decimal() ); ?>;
1020 + var order_tax = parseFloat( $( "#order_tax_standard" ).val() ) + parseFloat( $( "#order_tax_reduced" ).val() );
1021 + order_tax = Math.round( order_tax * Math.pow( 10, n ) ) / Math.pow( 10, n );
1022 + $( '#order_tax' ).val( order_tax );
1023 + },
1024 + <?php
1025 + endif;
1026 + ?>
1027 + settings: {
1028 + url: uscesL10n.requestFile,
1029 + type: 'POST',
1030 + cache: false
1031 + }
1032 + };
1033 +
1034 + uscesMail = {
1035 + sendmail : function() {
1036 + if($("#sendmailaddress").val() == "") return;
1037 + var email_attach_feature = <?php echo (int) $this->options['email_attach_feature']; ?>;
1038 + if (email_attach_feature == 1) {
1039 + if(!uscesMail.validateFileAttach()) return;
1040 + }
1041 +
1042 + var address = encodeURIComponent($("#sendmailaddress").val());
1043 + <?php if ( 1 === $add_html_email_option ) { ?>
1044 + var iframe = document.getElementById("iframeLoadEditor");
1045 + var message = encodeURIComponent(iframe.contentWindow.getContentEditor());
1046 + <?php } else { ?>
1047 + var message = encodeURIComponent($("#sendmailmessage").val());
1048 + <?php } ?>
1049 + var name = encodeURIComponent($("#sendmailname").val());
1050 + var subject = encodeURIComponent($("#sendmailsubject").val());
1051 + var order_id = $("#order_id").val();
1052 + var checked = $("#mailChecked").val();
1053 + var attachFile = document.getElementById("sendmailattachfile");
1054 +
1055 + var s = Object.assign({}, uscesMail.settings);
1056 + s.contentType = false;
1057 + s.processData = false;
1058 +
1059 + var formData = new FormData();
1060 + formData.append('action', 'order_item_ajax');
1061 + formData.append('mode', 'sendmail');
1062 + formData.append('wc_nonce', '<?php echo wp_create_nonce( 'wc_send_mail_order_nonce' ); ?>');
1063 + formData.append('mailaddress', address);
1064 + formData.append('message', message);
1065 + formData.append('name', name);
1066 + formData.append('subject', subject);
1067 + formData.append('order_id', order_id);
1068 + formData.append('checked', checked);
1069 + // Attach file
1070 + if (email_attach_feature == 1) {
1071 + if (attachFile.files[0]) {
1072 + formData.append('attachFile', attachFile.files[0]);
1073 + } else {
1074 + if (!confirm('<?php esc_html_e( 'Are you sure you want to send it without attachments?', 'usces' ); ?>')) return;
1075 + }
1076 + }
1077 + s.data = formData;
1078 +
1079 + <?php echo apply_filters( 'usces_filter_sendmail_js', '' ); ?>
1080 +
1081 + // add loading gif
1082 + var img_loading = '<div id="wrap_icon_loading"><img src="' + uscesL10n.USCES_PLUGIN_URL + 'images/loading.gif" /></div>';
1083 + $("#usces_email_bnt_send").prop("disabled", true);
1084 + $(img_loading).insertBefore("#usces_email_bnt_send");
1085 +
1086 + $.ajax( s ).done(function( data ){
1087 + $("#wrap_icon_loading").remove();
1088 + $("#usces_email_bnt_send").removeAttr('disabled');
1089 + if( $.trim(data) == 'success') {
1090 + if(checked == 'completionmail'){
1091 + $("input[name='check\[completionmail\]']").prop( "checked", true );
1092 + }else if(checked == 'ordermail'){
1093 + $("input[name='check\[ordermail\]']").prop( "checked", true );
1094 + }else if(checked == 'changemail'){
1095 + $("input[name='check\[changemail\]']").prop( "checked", true );
1096 + }else if(checked == 'receiptmail'){
1097 + $("input[name='check\[receiptmail\]']").prop( "checked", true );
1098 + }else if(checked == 'mitumorimail'){
1099 + $("input[name='check\[mitumorimail\]']").prop( "checked", true );
1100 + }else if(checked == 'cancelmail'){
1101 + $("input[name='check\[cancelmail\]']").prop( "checked", true );
1102 + }else if(checked == 'othermail'){
1103 + $("input[name='check\[othermail\]']").prop( "checked", true );
1104 + }
1105 + <?php echo apply_filters( 'usces_filter_order_check_mail_js', '' ); ?>
1106 +
1107 + $('#mailSendAlert').dialog('option', 'buttons', [
1108 + {
1109 + text: 'OK',
1110 + "class": 'button',
1111 + click: function() {
1112 + $(this).dialog('close');
1113 + $('#mailSendDialog').dialog('close');
1114 + }
1115 + }
1116 + ]);
1117 + $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
1118 + $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'E-mail has been sent.', 'usces' ); ?></p>');
1119 + $('#mailSendAlert').dialog('option', 'close', function() {
1120 + $(this).dialog('close');
1121 + $('#mailSendDialog').dialog('close');
1122 + });
1123 + $('#mailSendAlert').dialog( "option", "modal", true );
1124 + $('#mailSendAlert').dialog('open');
1125 +
1126 + }else if(data == 'error'){
1127 + $('#mailSendAlert').dialog('option', 'buttons', [
1128 + {
1129 + text: 'OK',
1130 + "class": 'button',
1131 + click: function() {
1132 + $(this).dialog('close');
1133 + }
1134 + }
1135 + ]);
1136 + $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1137 + $('#mailSendAlert fieldset').html('<p><?php _e( 'Failure in sending e-mails.', 'usces' ); ?></p>');
1138 + $('#mailSendAlert').dialog('option', 'close', function() {
1139 + $(this).dialog('close');
1140 + });
1141 + $('#mailSendAlert').dialog( "option", "modal", true );
1142 + $('#mailSendAlert').dialog('open');
1143 +
1144 + }else if(data == 'attachFileError'){
1145 + $('#mailSendAlert').dialog('option', 'buttons', [
1146 + {
1147 + text: 'OK',
1148 + "class": 'button',
1149 + click: function() {
1150 + $(this).dialog('close');
1151 + }
1152 + }
1153 + ]);
1154 + $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1155 + $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'Failure in attach file e-mails.', 'usces' ); ?></p>');
1156 + $('#mailSendAlert').dialog('option', 'close', function() {
1157 + $(this).dialog('close');
1158 + });
1159 + $('#mailSendAlert').dialog( "option", "modal", true );
1160 + $('#mailSendAlert').dialog('open');
1161 + }
1162 + }).fail(function( data ){
1163 + $("#wrap_icon_loading").remove();
1164 + $("#usces_email_bnt_send").removeAttr('disabled');
1165 + $('#mailSendAlert').dialog('option', 'buttons', [
1166 + {
1167 + text: 'OK',
1168 + "class": 'button',
1169 + click: function() {
1170 + $(this).dialog('close');
1171 + }
1172 + }
1173 + ]);
1174 + $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1175 + $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'Failure in sending e-mails.', 'usces' ); ?></p>');
1176 + $('#mailSendAlert').dialog('option', 'close', function() {
1177 + $(this).dialog('close');
1178 + });
1179 + $('#mailSendAlert').dialog( "option", "modal", true );
1180 + $('#mailSendAlert').dialog('open');
1181 + });
1182 + return false;
1183 + },
1184 + ordercheckpost : function( checked ) {
1185 + var p = uscesMail.settings;
1186 + var order_id = $("#order_id").val();
1187 + var wc_nonce = $("#wc_nonce").val();
1188 + p.url = uscesL10n.requestFile;
1189 + p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked + "&wc_nonce=" + wc_nonce;
1190 + $.ajax( p ).done(function( data ){
1191 + if($.trim(data) == 'mitumoriprint'){
1192 + $("input[name='check\[mitumoriprint\]']").prop( "checked", true );
1193 + }else if($.trim(data) == 'nohinprint'){
1194 + $("input[name='check\[nohinprint\]']").prop( "checked", true );
1195 + }else if($.trim(data) == 'billprint'){
1196 + $("input[name='check\[billprint\]']").prop( "checked", true );
1197 + }else if($.trim(data) == 'receiptprint'){
1198 + $("input[name='check\[receiptprint\]']").prop( "checked", true );
1199 + }
1200 + <?php echo apply_filters( 'usces_filter_order_check_print_js', '' ); ?>
1201 + }).fail(function( data ){ });
1202 + return false;
1203 + },
1204 + settings: {
1205 + url: uscesL10n.requestFile,
1206 + type: 'POST',
1207 + cache: false
1208 + },
1209 + validateFileAttach: function() {
1210 + var checkValidSize = true;
1211 + var checkValidExtension = true;
1212 + var attachFile = document.getElementById("sendmailattachfile");
1213 + var maximunFileSize = <?php echo (int) $this->options['email_attach_file_size']; ?>; // unit is Mb
1214 + var validFileExtensions = <?php echo json_encode( $email_attach_file_extension ); ?>; // file extension
1215 + if (attachFile && attachFile.files[0]) {
1216 + // validate file size
1217 + if (maximunFileSize > 0) {
1218 + if(attachFile.files[0].size > (maximunFileSize*1000000)){
1219 + checkValidSize = false;
1220 + };
1221 + }
1222 + // validate file extension
1223 + if (validFileExtensions.length > 0) {
1224 + checkValidExtension = false;
1225 + var filename = attachFile.files[0].name;
1226 + var aux = filename.split('.');
1227 + if (aux.length > 1) {
1228 + var extension = aux[aux.length -1].toLowerCase();
1229 + for (var j = 0; j < validFileExtensions.length; j++) {
1230 + var sCurExtension = validFileExtensions[j];
1231 + if (extension == sCurExtension.toLowerCase()) {
1232 + checkValidExtension = true;
1233 + break;
1234 + }
1235 + }
1236 + }
1237 + }
1238 + }
1239 +
1240 + if (!checkValidSize || !checkValidExtension) {
1241 + var msgSize = '';
1242 + var msgExtension = '';
1243 + attachFile.value = "";
1244 + $('#mailSendAlert').dialog('option', 'buttons', [
1245 + {
1246 + text: 'OK',
1247 + "class": 'button',
1248 + click: function() {
1249 + $(this).dialog('close');
1250 + }
1251 + }
1252 + ]);
1253 + if (!checkValidSize) {
1254 + msgSize = "<p><?php esc_html_e( 'The maximum file size that can be attached has been exceeded.', 'usces' ); ?></p>";
1255 + }
1256 + if (!checkValidExtension) {
1257 + msgExtension = "<p><?php esc_html_e( 'This is not a file extension that can be attached.', 'usces' ); ?></p>";
1258 + }
1259 + var content = msgSize + msgExtension;
1260 + $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1261 + $('#mailSendAlert fieldset').html(content);
1262 + $('#mailSendAlert').dialog('option', 'close', function() {
1263 + $(this).dialog('close');
1264 + });
1265 + $('#mailSendAlert').dialog( "option", "modal", true );
1266 + $('#mailSendAlert').dialog('open');
1267 + return false;
1268 + }
1269 + return true;
1270 + },
1271 + previewMail: function() {
1272 + var iframe = document.getElementById("iframeLoadEditor");
1273 + var content = iframe.contentWindow.getContentEditor();
1274 + var img_loading = '<div id="wrap_icon_loading"><img src="' + uscesL10n.USCES_PLUGIN_URL + 'images/loading.gif" /></div>';
1275 + $(img_loading).insertBefore("#usces_email_bnt_preview");
1276 + $("#usces_email_bnt_preview").prop("disabled", true);
1277 +
1278 + var setting = Object.assign({}, uscesMail.settings);
1279 + setting.data = {
1280 + 'action': 'usces_filter_content_wp_editor_preview',
1281 + 'mode': 'preview_email_order_detail',
1282 + 'wc_nonce': '<?php echo wp_create_nonce( 'wc_preview_editor_nonce' ); ?>',
1283 + 'content': content,
1284 + };
1285 + $.ajax(setting).done(function(res) {
1286 + $("#wrap_icon_loading").remove();
1287 + if (res && res.status) {
1288 + var dstFrame = document.getElementById('iframePreviewEmail');
1289 + var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
1290 + dstDoc.write(res.content);
1291 + dstDoc.close();
1292 +
1293 + $('#previewEmailDialog').dialog('option', 'title', "<?php esc_html_e( 'Preview email content', 'usces' ); ?>");
1294 + $('#previewEmailDialog').dialog('open');
1295 + } else {
1296 + uscesMail.contentPreviewErrorShow( '<?php esc_html_e( 'Failure preview email.', 'usces' ); ?>' );
1297 + }
1298 + $("#usces_email_bnt_preview").removeAttr('disabled');
1299 + }).fail(function(msg) {
1300 + $("#usces_email_bnt_preview").removeAttr('disabled');
1301 + $("#wrap_icon_loading").remove();
1302 + uscesMail.contentPreviewErrorShow( msg );
1303 + });
1304 + },
1305 + contentPreviewErrorShow: function( msg ) {
1306 + var dstFrame = document.getElementById('iframePreviewEmail');
1307 + var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
1308 + dstDoc.write( msg );
1309 + dstDoc.close();
1310 + jQuery('#previewEmailDialog').dialog('option', 'title', 'ERROR');
1311 + jQuery('#previewEmailDialog').dialog('open');
1312 + }
1313 + };
1314 +
1315 + $('form').submit(function() {
1316 + var error = 0;
1317 + <?php if ( usces_is_membersystem_point() ) : ?>
1318 + if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
1319 + error++;
1320 + $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
1321 + $(this).css({'background-color': '#FFF'});
1322 + });
1323 + }
1324 + <?php endif; ?>
1325 + if( !checkNum( $("#order_getdpoint").val() ) ) {
1326 + error++;
1327 + $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
1328 + $(this).css({'background-color': '#FFF'});
1329 + });
1330 + }
1331 + if( !checkPrice( $("#order_discount").val() ) ) {
1332 + error++;
1333 + $("#order_discount").css({'background-color': '#FFA'}).click(function() {
1334 + $(this).css({'background-color': '#FFF'});
1335 + });
1336 + }
1337 + if( !checkPrice( $("#order_shipping_charge").val() ) ) {
1338 + error++;
1339 + $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
1340 + $(this).css({'background-color': '#FFF'});
1341 + });
1342 + }
1343 + if( !checkPrice( $("#order_cod_fee").val() ) ) {
1344 + error++;
1345 + $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
1346 + $(this).css({'background-color': '#FFF'});
1347 + });
1348 + }
1349 + if( !checkPrice( $("#order_tax").val() ) ) {
1350 + error++;
1351 + $("#order_tax").css({'background-color': '#FFA'}).click(function() {
1352 + $(this).css({'background-color': '#FFF'});
1353 + });
1354 + }
1355 +
1356 + if( 0 < error ) {
1357 + $("#aniboxStatus").removeClass("none");
1358 + $("#aniboxStatus").addClass("error");
1359 + $("#info_image").attr("src", "<?php echo esc_url_raw( USCES_PLUGIN_URL ); ?>/images/list_message_error.gif");
1360 + $("#info_massage").html("<?php esc_html_e( 'Data have deficiency.', 'usces' ); ?>");
1361 + $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
1362 + return false;
1363 + } else {
1364 + return true;
1365 + }
1366 + });
1367 +
1368 + $( document ).on( 'click', '.delCartButton', function() {
1369 + if( confirm( "<?php esc_html_e( 'Are you sure of deleting items?', 'usces' ); ?>" ) ) {
1370 + return true;
1371 + } else {
1372 + return false;
1373 + }
1374 + });
1375 + <?php
1376 + do_action( 'usces_action_order_edit_page_js', $order_id, $data );
1377 + echo apply_filters( 'usces_filter_order_edit_page_js', '', $order_id );
1378 +
1379 + $delivery_date_select_script = "
1380 + $( function() {
1381 + $.datepicker.setDefaults( $.datepicker.regional['ja'] );
1382 + $( '#delivery_date_select' ).datepicker({
1383 + dateFormat: 'yy-mm-dd',
1384 + minDate: new Date( " . $order_yy . ', ' . $order_mm . ', ' . $order_dd . " )
1385 + });
1386 + $( '#delidue_date_select' ).datepicker({
1387 + dateFormat: 'yy-mm-dd',
1388 + minDate: new Date( " . $order_yy . ', ' . $order_mm . ', ' . $order_dd . " )
1389 + });
1390 + });\n";
1391 + echo apply_filters( 'usces_filter_order_edit_delivery_days_select_script', $delivery_date_select_script );
1392 + ?>
1393 +});
1394 +
1395 +function addComma(str) {
1396 + var strs = str.split('.');
1397 + cnt = 0;
1398 + n = "";
1399 + m = "";
1400 + if( strs[0].substr(0, 1) == "-" ) {
1401 + m = "-";
1402 + strs[0] = strs[0].substr(1);
1403 + }
1404 + for (i=strs[0].length-1; i>=0; i--)
1405 + {
1406 + n = strs[0].charAt(i) + n;
1407 + cnt++;
1408 + if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
1409 + }
1410 + n = m + n;
1411 + if(undefined != strs[1]){
1412 + res = n + '.' + strs[1];
1413 + }else{
1414 + res = n;
1415 + }
1416 + return res;
1417 +}
1418 +
1419 +function removeComma(str) {
1420 + var removed = str.split(',').join('');
1421 + return parseInt(removed);
1422 +}
1423 +
1424 +function pdfWindow( type ) {
1425 + var wx = 800;
1426 + var wy = 900;
1427 + var x = (screen.width- wx) / 2;
1428 + var y = (screen.height - wy) / 2;
1429 + x = 0;
1430 + y = 0;
1431 + printWin = window.open("<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&order_id=' . $order_id ); ?>"+"&type="+type,"sub","left="+x+",top="+y+",width="+wx+",height="+wy+",scrollbars=yes");
1432 +}
1433 +
1434 +function checkNumMinus( argValue ) {
1435 + if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
1436 + return false;
1437 + }
1438 + return true;
1439 +}
1440 +
1441 +function check_usedPoint( usedpoint ) {
1442 + var ret = true;
1443 + if( undefined == usedpoint || 0 == parseInt(usedpoint) ) {
1444 + return ret;
1445 + }
1446 + if( !checkNum(usedpoint) ) {
1447 + alert('<?php esc_html_e( 'Please enter a numeric value.', 'usces' ); ?>');
1448 + ret = false;
1449 + }
1450 + var mem_id = <?php echo ( isset( $data['mem_id'] ) ? esc_js( $data['mem_id'] ) : 0 ); ?>;
1451 + if( 0 == mem_id && 0 != usedpoint ){
1452 + alert('<?php esc_html_e( 'As a non-member, points cannot be entered.', 'usces' ); ?>');
1453 + ret = false;
1454 + }
1455 + if( 0 > usedpoint ){
1456 + alert('<?php esc_html_e( 'Invalid value. Please enter in the numbers.', 'usces' ); ?>');
1457 + ret = false;
1458 + }
1459 + if( 0 != mem_id ){
1460 + var mem_point = <?php echo esc_js( $mem_point ); ?> + <?php echo ( isset( $data['order_usedpoint'] ) ? esc_js( $data['order_usedpoint'] ) : 0 ); ?>;
1461 + var point_coverage = <?php echo ( isset( $this->options['point_coverage'] ) ? esc_js( $this->options['point_coverage'] ) : 0 ); ?>;
1462 + var total_items_price = removeComma(document.getElementById("item_total").innerHTML);
1463 + var discount = parseFloat(document.getElementById("order_discount").value );
1464 + var shipping_charge = parseFloat(document.getElementById("order_shipping_charge").value );
1465 + var cod_fee = parseFloat(document.getElementById("order_cod_fee").value );
1466 + var tax = parseFloat(document.getElementById("order_tax").value );
1467 + var tax_target = '<?php echo ( isset( $tax_target ) ? esc_js( $tax_target ) : '' ); ?>';
1468 + if( mem_point < usedpoint ){
1469 + alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + mem_point + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1470 + ret = false;
1471 + }
1472 + else{
1473 + if( point_coverage == 1 ){
1474 + target_full_price = total_items_price + discount + shipping_charge + cod_fee + tax;
1475 + if( usedpoint > target_full_price ){
1476 + alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + target_full_price + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1477 + ret = false;
1478 + }
1479 + }
1480 + else{
1481 + target_item_price = total_items_price + discount;
1482 + if( tax_target == 'products' ){
1483 + target_item_price += tax;
1484 + }
1485 + if( usedpoint > target_item_price ){
1486 + alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + target_item_price + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1487 + ret = false;
1488 + }
1489 + }
1490 + }
1491 + }
1492 + return ret;
1493 +}
1494 +
1495 +function delConfirm(){
1496 + if(confirm('<?php esc_html_e( 'Are you sure of deleting items?', 'usces' ); ?>')){
1497 + return true;
1498 + }else{
1499 + return false;
1500 + }
1501 +}
1502 +
1503 +jQuery(document).ready(function($){
1504 + // load show nav prev, next link.
1505 + <?php
1506 + $nonce_url = esc_url_raw( USCES_ADMIN_URL ) . '?page=usces_orderlist&order_action=edit&wc_nonce=' . wp_create_nonce( 'order_edit' ) . '&order_id=';
1507 + ?>
1508 + var sub_uri_link = '<?php echo $nonce_url; ?>';
1509 +
1510 + welPageNav.checkShowNextprevPage( 'wel_order_current_page_ids', sub_uri_link, <?php echo esc_attr( $order_id ); ?> );
1511 +
1512 + $(document).on( "click", "#mailVisiLink", function() {
1513 + if( $("#mailBox").css("display") == "block" ) {
1514 + $("#mailBox").css("display", "none");
1515 + $("#mailVisiLink").html('<?php esc_html_e( 'Show the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-down"></span>');
1516 + } else {
1517 + $("#mailBox").css("display", "block");
1518 + $("#mailVisiLink").html('<?php esc_html_e( 'Hide the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-up"></span>');
1519 + }
1520 + });
1521 +
1522 + orderfunc.sumPrice(null);
1523 +
1524 + $( document ).on( "change", "input[name*='skuPrice']", function() {
1525 + orderfunc.sumPrice( $(this) );
1526 + });
1527 + $( document ).on( "change", "input[name*='quant']", function() {
1528 + orderfunc.sumPrice( $(this) );
1529 + });
1530 + $( document ).on( "click", "input[name*='delButton']", function() {
1531 + orderfunc.sumPrice( null );
1532 + });
1533 + $( document ).on( "change", "#order_usedpoint", function() {
1534 + orderfunc.sumPrice( $("#order_usedpoint") );
1535 + });
1536 + <?php
1537 + if ( $reduced_taxrate ) :
1538 + ?>
1539 + $( document ).on( "change", "#order_discount_standard", function() {
1540 + orderfunc.sumDiscount();
1541 + orderfunc.sumPrice( null );
1542 + });
1543 + $( document ).on( "change", "#order_discount_reduced", function() {
1544 + orderfunc.sumDiscount();
1545 + orderfunc.sumPrice( null );
1546 + });
1547 + <?php
1548 + endif;
1549 + ?>
1550 + $( document ).on( "change", "#order_discount", function() {
1551 + orderfunc.sumPrice( $("#order_discount") );
1552 + });
1553 + $( document ).on( "change", "#order_shipping_charge", function() {
1554 + orderfunc.sumPrice( $("#order_shipping_charge") );
1555 + });
1556 + $( document ).on( "change", "#order_cod_fee", function() {
1557 + orderfunc.sumPrice( $("#order_cod_fee") );
1558 + });
1559 + <?php
1560 + if ( $reduced_taxrate ) :
1561 + ?>
1562 + $( document ).on( "change", "#order_tax_standard", function() {
1563 + orderfunc.sumTax();
1564 + orderfunc.sumPrice( null );
1565 + });
1566 + $( document ).on( "change", "#order_tax_reduced", function() {
1567 + orderfunc.sumTax();
1568 + orderfunc.sumPrice( null );
1569 + });
1570 + <?php
1571 + endif;
1572 + ?>
1573 + $( document ).on( "change", "#order_tax", function() {
1574 + orderfunc.sumPrice( $("#order_tax") );
1575 + });
1576 + $( document ).on( "click", "input[name*='update_order_edit']", function() {
1577 + if( ('completion' == $("#order_taio option:selected").val() || 'continuation' == $("#order_taio option:selected").val()) && '<?php echo substr( get_date_from_gmt( gmdate( 'Y-m-d H:i:s', time() ) ), 0, 10 ); ?>' != $('#modified').val() ){
1578 + if( confirm("<?php esc_html_e( "Are you sure you want to change to today's date Date of renovation?", 'usces' ); ?>\n<?php esc_html_e( 'Please press the cancel If you want to update without changing the modified date.', 'usces' ); ?>") ){
1579 + $('#up_modified').val('update');
1580 + }else{
1581 + $('#up_modified').val('');
1582 + }
1583 + }
1584 + <?php do_action( 'usces_action_update_order_edit_js', $order_id, $data ); ?>
1585 + return true;
1586 + });
1587 + orderfunc.make_delivery_time(<?php echo esc_js( $order_delivery_method ); ?>);
1588 +
1589 + $( document ).on( "click", "#get_member", function() {
1590 + if( '' == $("input[name='customer[mailaddress]']").val() ){
1591 + alert("<?php esc_html_e( 'Enter the e-mail.', 'usces' ); ?>");
1592 + return;
1593 + }
1594 + if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
1595 + if( !confirm("<?php esc_html_e( "I will overwrite the ship-to address the customer's address. Would you like?", 'usces' ); ?>") ){
1596 + return;
1597 + }
1598 + }
1599 + orderfunc.getMember($("input[name='customer[mailaddress]']").val());
1600 + });
1601 + <?php
1602 + if ( 'new' === $order_action ) :
1603 + ?>
1604 + $( document ).on( "click", "#customercopy", function() {
1605 + if( '' != $("input[name='delivery[name1]']").val() ||
1606 + '' != $("input[name='delivery[name2]']").val() ||
1607 + '' != $("input[name='delivery[name3]']").val() ||
1608 + '' != $("input[name='delivery[name4]']").val() ||
1609 + '' != $("input[name='delivery[zipcode]']").val() ||
1610 + '' != $("input[name='delivery[address1]']").val() ||
1611 + '' != $("input[name='delivery[address2]']").val() ||
1612 + '' != $("input[name='delivery[address3]']").val() ||
1613 + '' != $("input[name='delivery[tel]']").val() ||
1614 + '' != $("input[name='delivery[fax]']").val() ) {
1615 + if( !confirm("<?php esc_html_e( 'I will overwrite the ship-to address the customer\'s address. Would you like?', 'usces' ); ?>") ) {
1616 + return;
1617 + }
1618 + }
1619 + $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
1620 + $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
1621 + $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
1622 + $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
1623 + $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
1624 + $("#delivery_country").val($("#customer_country option:selected").val());
1625 + $("#delivery_pref").val($("#customer_pref option:selected").val());
1626 + $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
1627 + $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
1628 + $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
1629 + $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
1630 + $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
1631 + });
1632 + <?php
1633 + endif;
1634 + ?>
1635 +
1636 + $( document ).on( "click", "#recalc", function() {
1637 + orderfunc.recalculation();
1638 + });
1639 + <?php
1640 + if ( $reduced_taxrate ) :
1641 + if ( ! $usces_tax->was_reduced_taxrate_before( $order_id ) ) :
1642 + ?>
1643 + jQuery.event.add( window, "load", function() {
1644 + orderfunc.sumDiscount();
1645 + orderfunc.sumTax();
1646 + orderfunc.sumPrice();
1647 + });
1648 + <?php
1649 + endif;
1650 + endif;
1651 + ?>
1652 +});
1653 +</script>
1654 +<script type="text/javascript">
1655 +jQuery(document).ready(function($) {
1656 + var formChanged = false;
1657 +
1658 + $('#order_editpost_form').change(function() {
1659 + formChanged = true;
1660 + });
1661 +
1662 + window.onbeforeunload = function() {
1663 + if (formChanged) {
1664 + return true;
1665 + }
1666 + };
1667 +
1668 + $('#order_editpost_form').submit(function() {
1669 + formChanged = false;
1670 + });
1671 +});
1672 +</script>
1673 +
1674 +<div class="wrap">
1675 +<div class="usces_admin">
1676 +<form id="order_editpost_form" action="<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=' . $oa ); ?>" method="post" name="editpost">
1677 +<h1>Welcart Management <?php esc_html_e( 'Edit order data', 'usces' ); ?></h1>
1678 +<p class="version_info">Version <?php echo esc_html( USCES_VERSION ); ?></p>
1679 +<?php
1680 +usces_admin_action_status();
1681 +if ( $navibutton ) {
1682 + echo '<div class="edit_pagenav">' . $navibutton . '</div>';
1683 +}
1684 +?>
1685 +<div class="usces_tablenav usces_tablenav_top">
1686 +<div class="ordernavi"><input name="update_order_edit" class="button button-primary" type="submit" value="<?php esc_attr_e( 'change decision', 'usces' ); ?>" /><?php esc_html_e( "When you change amount, please click 'Edit' before you finish your process.", 'usces' ); ?></div>
1687 +<div id="mailVisiLink" class="screen-field"><?php esc_html_e( 'Show the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-down"></span></div>
1688 +</div><!-- .usces_tablenav .usces_tablenav_top -->
1689 +<div id="mailBox">
1690 +<?php
1691 +$chk_ordermail = ( isset( $ordercheck['ordermail'] ) ) ? ' checked="checked"' : '';
1692 +$chk_changemail = ( isset( $ordercheck['changemail'] ) ) ? ' checked="checked"' : '';
1693 +$chk_receiptmail = ( isset( $ordercheck['receiptmail'] ) ) ? ' checked="checked"' : '';
1694 +$chk_mitumorimail = ( isset( $ordercheck['mitumorimail'] ) ) ? ' checked="checked"' : '';
1695 +$chk_cancelmail = ( isset( $ordercheck['cancelmail'] ) ) ? ' checked="checked"' : '';
1696 +$chk_othermail = ( isset( $ordercheck['othermail'] ) ) ? ' checked="checked"' : '';
1697 +$chk_completionmail = ( isset( $ordercheck['completionmail'] ) ) ? ' checked="checked"' : '';
1698 +$chk_mitumoriprint = ( isset( $ordercheck['mitumoriprint'] ) ) ? ' checked="checked"' : '';
1699 +$chk_nohinprint = ( isset( $ordercheck['nohinprint'] ) ) ? ' checked="checked"' : '';
1700 +$chk_billprint = ( isset( $ordercheck['billprint'] ) ) ? ' checked="checked"' : '';
1701 +$chk_receiptprint = ( isset( $ordercheck['receiptprint'] ) ) ? ' checked="checked"' : '';
1702 +?>
1703 +<table>
1704 +<tr>
1705 +<td><input name="check[ordermail]" type="checkbox" value="ordermail"<?php echo esc_attr( $chk_ordermail ); ?> /><a href="#" id="orderConfirmMail"><?php esc_html_e( 'Mail for confirmation of order', 'usces' ); ?></a></td>
1706 +<td><input name="check[changemail]" type="checkbox" value="changemail"<?php echo esc_attr( $chk_changemail ); ?> /><a href="#" id="changeConfirmMail"><?php esc_html_e( 'Mail for confiemation of change', 'usces' ); ?></a></td>
1707 +<td><input name="check[receiptmail]" type="checkbox" value="receiptmail"<?php echo esc_attr( $chk_receiptmail ); ?> /><a href="#" id="receiptConfirmMail"><?php esc_html_e( 'Mail for confirmation of transter', 'usces' ); ?></a></td>
1708 +<td><input name="check[mitumorimail]" type="checkbox" value="mitumorimail"<?php echo esc_attr( $chk_mitumorimail ); ?> /><a href="#" id="mitumoriConfirmMail"><?php esc_html_e( 'estimate mail', 'usces' ); ?></a></td>
1709 +<td><input name="check[cancelmail]" type="checkbox" value="cancelmail"<?php echo esc_attr( $chk_cancelmail ); ?> /><a href="#" id="cancelConfirmMail"><?php esc_html_e( 'Cancelling mail', 'usces' ); ?></a></td>
1710 +<td><input name="check[othermail]" type="checkbox" value="othermail"<?php echo esc_attr( $chk_othermail ); ?> /><a href="#" id="otherConfirmMail"><?php esc_html_e( 'Other mail', 'usces' ); ?></a></td>
1711 +</tr>
1712 +<tr>
1713 +<td><input name="check[completionmail]" type="checkbox" value="completionmail"<?php echo esc_attr( $chk_completionmail ); ?> /><a href="#" id="completionMail"><?php esc_html_e( 'Mail for Shipping', 'usces' ); ?></a></td>
1714 +<td><input name="check[mitumoriprint]" type="checkbox" value="mitumoriprint"<?php echo esc_attr( $chk_mitumoriprint ); ?> /><a href="#" id="mitumoriprint"><?php esc_html_e( 'print out the estimate', 'usces' ); ?></a></td>
1715 +<td><input name="check[nohinprint]" type="checkbox" value="nohinprint"<?php echo esc_attr( $chk_nohinprint ); ?> /><a href="#" id="nohinprint"><?php esc_html_e( 'print out Delivery Statement', 'usces' ); ?></a></td>
1716 +<td><input name="check[billprint]" type="checkbox" value="billprint"<?php echo esc_attr( $chk_billprint ); ?> /><a href="#" id="billprint"><?php esc_html_e( 'Print Invoice', 'usces' ); ?></a></td>
1717 +<td><input name="check[receiptprint]" type="checkbox" value="receiptprint"<?php echo esc_attr( $chk_receiptprint ); ?> /><a href="#" id="receiptprint"><?php esc_html_e( 'Print Receipt', 'usces' ); ?></a></td>
1718 +<?php echo apply_filters( 'usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
1719 +</tr>
1720 +<tr>
1721 +<td colspan="12"><span style="color:#CC3300"><?php esc_html_e( "When there is any change, please press the 'change decision' before you send or print.", 'usces' ); ?></span></td>
1722 +</tr>
1723 +</table>
1724 +</div><!-- #mailBox -->
1725 +<?php
1726 +$dsp_order_id = ( isset( $data['ID'] ) ) ? $data['ID'] : '';
1727 +$dsp_order_deco_id = ( isset( $data['ID'] ) ) ? usces_get_deco_order_id( $data['ID'] ) : '';
1728 +$dsp_order_date = ( isset( $data['order_date'] ) ) ? $data['order_date'] : '';
1729 +$dsp_order_modified = ( isset( $data['order_modified'] ) ) ? $data['order_modified'] : '';
1730 +$dsp_member_id = ( ! empty( $data['mem_id'] ) ) ? $data['mem_id'] : '-';
1731 +$hdn_member_id = ( isset( $data['mem_id'] ) ) ? $data['mem_id'] : '';
1732 +$hdn_getpoint = ( isset( $data['order_getpoint'] ) ) ? $data['order_getpoint'] : '';
1733 +$hdn_usedpoint = ( isset( $data['order_usedpoint'] ) ) ? $data['order_usedpoint'] : '';
1734 +$usces_referer = ( isset( $_REQUEST['usces_referer'] ) ) ? $_REQUEST['usces_referer'] : '';
1735 +?>
1736 +<div class="info_head">
1737 +<table>
1738 +
1739 + <tr>
1740 + <td colspan="6" class="midasi0"><?php esc_html_e( 'order details', 'usces' ); ?></td>
1741 + </tr>
1742 +
1743 + <?php do_action( 'usces_action_order_edit_form_detail_top', $data, $csod_meta, $filter_args ); ?>
1744 +
1745 + <tr>
1746 + <td class="label border"><?php esc_html_e( 'Order number', 'usces' ); ?><br />(<?php echo esc_html( $dsp_order_id ); ?>)</td>
1747 + <td class="col1 border"><div class="rod"><?php echo esc_html( $dsp_order_deco_id ); ?></div></td>
1748 + <td class="col3 label border"><?php esc_html_e( 'order date', 'usces' ); ?></td>
1749 + <td class="col2 border"><div class="rod long"><?php echo esc_html( $dsp_order_date ); ?></div></td>
1750 + <td class="label border"><?php echo apply_filters( 'usces_filter_admin_modified_label', __( 'shpping date', 'usces' ) ); ?></td>
1751 + <td class="border"><div id="order_modified" class="rod long"><?php echo esc_html( $dsp_order_modified ); ?></div></td>
1752 + </tr>
1753 +
1754 + <tr>
1755 + <td class="label"><?php esc_html_e( 'membership number', 'usces' ); ?></td>
1756 + <td class="col1"><div id="member_id_label" class="rod large short"><?php echo esc_html( $dsp_member_id ); ?></div>
1757 + <?php if ( 'new' === $order_action ) { ?>
1758 + <input name="member_id" id="member_id" type="hidden" />
1759 + <?php } else { ?>
1760 + <input name="member_id" id="member_id" type="hidden" value="<?php echo esc_attr( $hdn_member_id ); ?>" />
1761 + <?php } ?>
1762 + </td>
1763 +
1764 + <td colspan="2" class="wrap_td">
1765 + <table border="0" cellspacing="0" class="cus_info">
1766 + <tr>
1767 + <td class="label"><?php esc_html_e( 'e-mail adress', 'usces' ); ?></td>
1768 + <td class="col2"><input name="customer[mailaddress]" type="text" class="text long" value="<?php echo esc_attr( isset( $data['order_email'] ) ? $data['order_email'] : '' ); ?>" />
1769 + <input name="get_member" type="button" class="button" id="get_member" value="<?php esc_attr_e( 'Membership information acquisition', 'usces' ); ?>" />
1770 + </td>
1771 + </tr>
1772 + </table>
1773 + </td>
1774 +
1775 + <?php
1776 + if ( 'new' === $order_action ) :
1777 + ?>
1778 + <td colspan="2" class="midasi1"><?php esc_html_e( 'shipping address', 'usces' ); ?><input type="button" class="button" id="customercopy" value="<?php esc_attr_e( 'Same shipping address', 'usces' ); ?>"></td>
1779 + <?php else : ?>
1780 + <td colspan="2" class="midasi1"><?php esc_html_e( 'shipping address', 'usces' ); ?></td>
1781 + <?php endif; ?>
1782 + </tr>
1783 +
1784 + <tr>
1785 + <td colspan="2" class="wrap_td right_area">
1786 + <!-- Delivery brock -->
1787 + <table border="0" cellspacing="0" class="cus_info">
1788 + <tr>
1789 + <td class="label"><?php esc_html_e( 'payment method', 'usces' ); ?></td>
1790 + <td class="col1">
1791 + <select name="offer[payment_name]" id="order_payment_name">
1792 + <option value="#none#"><?php esc_html_e( '-- Select --', 'usces' ); ?></option>
1793 + <?php
1794 + if ( $payment_method ) {
1795 + foreach ( (array) $payment_method as $payments ) {
1796 + if ( '' != $payments['name'] ) {
1797 + $selected = ( isset( $data['order_payment_name'] ) && $payments['name'] === $data['order_payment_name'] ) ? ' selected="selected"' : '';
1798 + ?>
1799 + <option value="<?php echo esc_attr( $payments['name'] ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_attr( $payments['name'] ); ?></option>
1800 + <?php
1801 + }
1802 + }
1803 + }
1804 + ?>
1805 + </select>
1806 + </td>
1807 + </tr>
1808 + <tr>
1809 + <td class="label"><?php esc_html_e( 'shipping option', 'usces' ); ?></td>
1810 + <td class="col1">
1811 + <select name="offer[delivery_method]" id="delivery_method_select">
1812 + <option value="-1"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>
1813 + <?php
1814 + foreach ( (array) $this->options['delivery_method'] as $dkey => $delivery ) {
1815 + $selected = ( $order_delivery_method == $delivery['id'] ) ? ' selected="selected"' : '';
1816 + echo "\t<option value='" . esc_attr( $delivery['id'] ) . "'{$selected}>" . esc_attr( $delivery['name'] ) . "</option>\n";
1817 + }
1818 + ?>
1819 + </select>
1820 + </td>
1821 + </tr>
1822 + <tr>
1823 + <td class="label"><?php esc_html_e( 'Delivery date', 'usces' ); ?></td>
1824 + <td class="col1">
1825 + <?php
1826 + $delivery_days_select = '<input type="text" name="offer[delivery_date]" id="delivery_date_select" style="width:100%;" value="' . $delivery_date . '" />';
1827 + echo apply_filters( 'usces_filter_order_edit_delivery_days_select', $delivery_days_select, $data, $delivery_after_days, $no_preference );
1828 + ?>
1829 + </td>
1830 + </tr>
1831 + <tr>
1832 + <td class="label"><?php esc_html_e( 'delivery time', 'usces' ); ?></td>
1833 + <td class="col1">
1834 + <select name="offer[delivery_time]" id="delivery_time_select">
1835 + <option value="<?php esc_html_e( 'Non-request', 'usces_dual' ); ?>"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>
1836 + </select>
1837 + </td>
1838 + </tr>
1839 + <tr>
1840 + <td class="label"><?php esc_html_e( 'Shipping date', 'usces' ); ?></td>
1841 + <td class="col1">
1842 + <input type="text" name="offer[delidue_date]" id="delidue_date_select" style="width:100%;" value="<?php echo esc_attr( $delidue_date ); ?>" />
1843 + </td>
1844 + </tr>
1845 + <?php do_action( 'usces_action_order_edit_form_delivery_block', $data, $cscs_meta, $action_args ); ?>
1846 + </table>
1847 + </td>
1848 +
1849 + <td colspan="2" rowspan="2" class="wrap_td">
1850 + <table border="0" cellspacing="0" class="cus_info">
1851 + <?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
1852 + </table>
1853 + </td>
1854 +
1855 + <td colspan="2" rowspan="2" class="wrap_td">
1856 + <table border="0" cellspacing="0" class="deli_info">
1857 + <?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
1858 + </table>
1859 + </td>
1860 + </tr>
1861 +
1862 + <tr>
1863 + <td colspan="2" rowspan="2" class="wrap_td">
1864 + <!-- Status brock -->
1865 + <table border="0" cellspacing="0" class="cus_info">
1866 + <tr>
1867 + <td colspan="2" class="midasi3"><?php esc_html_e( 'Status', 'usces' ); ?></td>
1868 + </tr>
1869 + <tr>
1870 + <td class="label status"><?php esc_html_e( 'The correspondence situation', 'usces' ); ?></td>
1871 + <td class="col1 status">
1872 + <select name="offer[taio]" id="order_taio">
1873 + <option value='#none#'><?php esc_html_e( 'new order', 'usces' ); ?></option>
1874 + <?php
1875 + $exclusion_status = apply_filters( 'usces_filter_taio_exclusion_status', array( 'noreceipt', 'receipted', 'pending', 'estimate', 'adminorder' ) );
1876 + foreach ( $management_status as $status_key => $status_name ) :
1877 + if ( in_array( $status_key, $exclusion_status ) ) {
1878 + continue;
1879 + }
1880 + ?>
1881 + <option value="<?php echo esc_attr( $status_key ); ?>"<?php selected( $taio, $status_key ); ?>><?php echo esc_html( $status_name ); ?></option>
1882 + <?php
1883 + endforeach;
1884 + ?>
1885 + </select>
1886 + </td>
1887 + </tr>
1888 + <?php
1889 + $receiptlabel = '&nbsp;';
1890 + $receiptbox = '&nbsp;';
1891 + if ( '' != $receipt ) {
1892 + $receiptlabel = __( 'transfer statement', 'usces' );
1893 + $selected = array( 'noreceipt' => '', 'receipted' => '', 'pending' => '' );
1894 + if ( array_key_exists( $receipt, $selected ) ) {
1895 + $selected[ $receipt ] = ' selected="selected"';
1896 + }
1897 + $receiptbox = '
1898 + <select name="offer[receipt]">
1899 + <option value="noreceipt"' . $selected['noreceipt'] . '>' . $management_status['noreceipt'] . '</option>
1900 + <option value="receipted"' . $selected['receipted'] . '>' . $management_status['receipted'] . '</option>
1901 + <option value="pending"' . $selected['pending'] . '>' . $management_status['pending'] . '</option>
1902 + </select>';
1903 + }
1904 + ?>
1905 + <tr>
1906 + <td class="label status" id="receiptlabel"><?php echo $receiptlabel; ?></td>
1907 + <td class="col1 status" id="receiptbox"><?php echo $receiptbox; ?></td>
1908 + </tr>
1909 + <?php
1910 + if ( '' != $admin ) :
1911 + ?>
1912 + <tr>
1913 + <td class="label status"><?php esc_html_e( 'estimate order', 'usces' ); ?></td>
1914 + <td class="col1 status">
1915 + <select name="offer[admin]">
1916 + <option value='adminorder'<?php selected( $admin, 'adminorder' ); ?>><?php echo esc_html( $management_status['adminorder'] ); ?></option>
1917 + <option value='estimate'<?php selected( $admin, 'estimate' ); ?>><?php echo esc_html( $management_status['estimate'] ); ?></option>
1918 + </select>
1919 + </td>
1920 + </tr>
1921 + <?php endif; ?>
1922 + <?php do_action( 'usces_action_order_edit_form_status_block_middle', $data, $cscs_meta, $action_args ); ?>
1923 + <tr>
1924 + <td colspan="2" class="status">
1925 + <div class="midasi2">
1926 + <?php
1927 + if ( isset( $condition['display_mode'] ) ) {
1928 + if ( 'Usualsale' == $condition['display_mode'] ) {
1929 + esc_html_e( 'normal sale', 'usces' );
1930 + } elseif ( 'Promotionsale' == $condition['display_mode'] ) {
1931 + esc_html_e( 'Sale Campaign', 'usces' );
1932 + }
1933 + }
1934 + ?>
1935 + </div>
1936 + <div class="condition">
1937 + <?php
1938 + if ( isset( $condition['display_mode'] ) && isset( $condition['campaign_privilege'] ) ) :
1939 + if ( 'Promotionsale' == $condition['display_mode'] ) :
1940 + if ( 'discount' == $condition['campaign_privilege'] && isset( $condition['privilege_discount'] ) ) {
1941 + $dsp_campaign_privilege = $condition['privilege_discount'] . __( '% Discount', 'usces' );
1942 + } elseif ( 'point' == $condition['campaign_privilege'] && isset( $condition['privilege_point'] ) ) {
1943 + $dsp_campaign_privilege = $condition['privilege_point'] . __( ' times (limited to members)', 'usces' );
1944 + } else {
1945 + $dsp_campaign_privilege = '';
1946 + }
1947 + if ( ! isset( $condition['campaign_category'] ) || 0 == $condition['campaign_category'] ) {
1948 + $dsp_campaign_category = __( 'all the items', 'usces' );
1949 + } else {
1950 + $dsp_campaign_category = get_cat_name( $condition['campaign_category'] );
1951 + }
1952 + ?>
1953 + <span><?php esc_html_e( 'Special Benefits', 'usces' ); ?> : </span><?php echo esc_html( $condition['campaign_privilege'] ); ?> (<?php echo esc_html( $dsp_campaign_privilege ); ?>) <br />
1954 + <span><?php esc_html_e( 'applied material', 'usces' ); ?> : </span><?php echo esc_html( $dsp_campaign_category ); ?><br />
1955 + <?php
1956 + endif;
1957 + endif;
1958 + ?>
1959 + </div></td>
1960 + </tr>
1961 + <?php do_action( 'usces_action_order_edit_form_status_block', $data, $cscs_meta, $action_args ); ?>
1962 + </table>
1963 + </td>
1964 + </tr>
1965 +
1966 + <tr>
1967 + <td class="label cus_note_label"><?php esc_html_e( 'Notes', 'usces' ); ?></td>
1968 + <td colspan="3" class="cus_note_value"><textarea name="offer[note]"><?php echo esc_attr( isset( $data['order_note'] ) ? $data['order_note'] : '' ); ?></textarea></td>
1969 + </tr>
1970 + <?php do_action( 'usces_action_order_edit_form_detail_bottom', $data, $cscs_meta, $action_args ); ?>
1971 +</table>
1972 +</div><!-- .info_head -->
1973 +
1974 +<div class="info_head">
1975 +<table>
1976 +<tr>
1977 +<td class="midasi0"><?php esc_html_e( 'Custom order field', 'usces' ); ?></td>
1978 +<td class="midasi0"><?php esc_html_e( 'Payment information', 'usces' ); ?></td>
1979 +</tr>
1980 +<tr>
1981 +<td class="wrap_td">
1982 +<table class="order_custom_wrap">
1983 +<tr>
1984 +<?php
1985 +do_action( 'usces_action_order_edit_form_custom', $data, $csod_meta );
1986 +usces_admin_custom_field_input( $csod_meta, 'order', '' );
1987 +if ( ! empty( $deleted_csod_meta_display ) ) {
1988 + wel_esc_script_e( $deleted_csod_meta_display );
1989 +}
1990 +?>
1991 +</tr>
1992 +</table><!-- .order_custom_wrap -->
1993 +</td>
1994 +<td class="wrap_td">
1995 +<table class="settle_info_wrap">
1996 +<?php usces_settle_info_field( $order_id, 'tr' ); ?>
1997 +</table><!-- .settle_info_wrap -->
1998 +<?php do_action( 'usces_action_order_edit_form_settle_info', $data, $action_args ); ?>
1999 +</td>
2000 +</tr>
2001 +</table>
2002 +</div><!-- .info_head -->
2003 +
2004 +<div id="cart">
2005 +<?php
2006 +ob_start();
2007 +?>
2008 +<table cellspacing="0" id="cart_table">
2009 + <thead>
2010 + <tr>
2011 + <th colspan="5" class="aright"><?php esc_html_e( 'Total Amount', 'usces' ); ?></th>
2012 + <th id="total_full_top" class="aright">&nbsp;</th>
2013 + <th colspan="2">&nbsp;<?php esc_html_e( 'Currency', 'usces' ); ?>(<?php usces_crcode(); ?>)</th>
2014 + </tr>
2015 + <tr>
2016 + <th scope="row" class="num"><?php esc_html_e( 'No.', 'usces' ); ?></th>
2017 + <th class="thumbnail"> <?php // esc_html_e( 'thumbnail', 'usces' ); ?></th>
2018 + <th class="productname"><?php esc_html_e( 'Items', 'usces' ); ?></th>
2019 + <th class="price"><?php esc_html_e( 'Unit price', 'usces' ); ?></th>
2020 + <th class="quantity"><?php esc_html_e( 'Quantity', 'usces' ); ?></th>
2021 + <th class="subtotal"><?php esc_html_e( 'Amount', 'usces' ); ?>(<?php usces_crcode(); ?>)</th>
2022 + <th class="stock"><?php esc_html_e( 'Current stock', 'usces' ); ?></th>
2023 + <th class="action"><input name="addButton" id="addCartButton" class="button" type="button" value="<?php esc_html_e( 'Add item', 'usces' ); ?>" /></th>
2024 + </tr>
2025 + </thead>
2026 + <tbody id="orderitemlist">
2027 + <?php echo usces_get_ordercart_row( $order_id, $cart ); ?>
2028 + </tbody>
2029 + <tfoot>
2030 + <tr>
2031 + <th colspan="5" class="aright"><?php esc_html_e( 'total items', 'usces' ); ?></th>
2032 + <th id="item_total" class="aright">&nbsp;</th>
2033 + <?php echo apply_filters( 'usces_filter_ordereditform_item_total_td', '<th colspan="2">&nbsp;</th>', $order_id, $cart ); ?>
2034 + </tr>
2035 + <?php
2036 + if ( $reduced_taxrate ) :
2037 + if ( 'products' == $tax_target ) :
2038 + $dsp_subtotal_standard = ( ! empty( $order_subtotal_standard ) ) ? usces_crform( $order_subtotal_standard, false, false, 'return', false ) : '0';
2039 + $dsp_subtotal_reduced = ( ! empty( $order_subtotal_reduced ) ) ? usces_crform( $order_subtotal_reduced, false, false, 'return', false ) : '0';
2040 + ?>
2041 + <tr>
2042 + <th colspan="5" class="aright"><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></th>
2043 + <th id="subtotal_standard" class="aright">&nbsp;</th>
2044 + <th colspan="2"><input type="hidden" name="order_subtotal_standard" id="order_subtotal_standard" value="<?php echo esc_attr( $dsp_subtotal_standard ); ?>">&nbsp;</th>
2045 + </tr>
2046 + <tr>
2047 + <th colspan="5" class="aright"></span><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></th>
2048 + <th id="subtotal_reduced" class="aright">&nbsp;</th>
2049 + <th colspan="2"><input type="hidden" name="order_subtotal_reduced" id="order_subtotal_reduced" value="<?php echo esc_attr( $dsp_subtotal_reduced ); ?>">&nbsp;</th>
2050 + </tr>
2051 + <?php
2052 + endif;
2053 + $dsp_discount_standard = ( ! empty( $order_discount_standard ) ) ? usces_crform( $order_discount_standard, false, false, 'return', false ) : '0';
2054 + $dsp_discount_reduced = ( ! empty( $order_discount_reduced ) ) ? usces_crform( $order_discount_reduced, false, false, 'return', false ) : '0';
2055 + $dsp_discount = ( isset( $data['order_discount'] ) && ! empty( $data['order_discount'] ) ) ? usces_crform( $data['order_discount'], false, false, 'return', false ) : '0';
2056 + ?>
2057 + <tr>
2058 + <td colspan="5" class="aright"><?php printf( __( 'Discount from the subtotal applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></td>
2059 + <td class="aright"><input name="order_discount_standard" id="order_discount_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_discount_standard ); ?>" /></td>
2060 + <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2061 + </tr>
2062 + <tr>
2063 + <td colspan="5" class="aright"><?php printf( __( 'Discount from the subtotal applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></td>
2064 + <td class="aright"><input name="order_discount_reduced" id="order_discount_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_discount_reduced ); ?>" /></td>
2065 + <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2066 + </tr>
2067 + <tr>
2068 + <td colspan="5" class="aright"><?php echo apply_filters( 'usces_confirm_discount_label', __( 'Discount', 'usces' ), $order_id ); ?></td>
2069 + <td class="aright"><input name="offer[discount]" id="order_discount" class="text price" type="text" value="<?php echo esc_attr( $dsp_discount ); ?>" readonly /></td>
2070 + <td colspan="2">&nbsp;</td>
2071 + </tr>
2072 + <?php
2073 + else :
2074 + $dsp_discount = ( isset( $data['order_discount'] ) && ! empty( $data['order_discount'] ) ) ? usces_crform( $data['order_discount'], false, false, 'return', false ) : '0';
2075 + ?>
2076 + <tr>
2077 + <td colspan="5" class="aright"><?php echo apply_filters( 'usces_confirm_discount_label', __( 'Campaign discount', 'usces' ), $order_id ); ?></td>
2078 + <td class="aright"><input name="offer[discount]" id="order_discount" class="text price" type="text" value="<?php echo esc_attr( $dsp_discount ); ?>" /></td>
2079 + <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2080 + </tr>
2081 + <?php
2082 + endif;
2083 + if ( $reduced_taxrate ) :
2084 + if ( 'products' == $tax_target ) :
2085 + if ( 'exclude' == $tax_mode ) {
2086 + if ( empty( $order_tax_standard ) && empty( $order_tax_reduced ) ) {
2087 + $order_tax_standard = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? $data['order_tax'] : 0;
2088 + }
2089 + $msg_notice = __( 'It will be not caluculated automatically.', 'usces' );
2090 + } else {
2091 + $msg_notice = '';
2092 + }
2093 + $dsp_tax_standard = ( ! empty( $order_tax_standard ) ) ? usces_crform( $order_tax_standard, false, false, 'return', false ) : '0';
2094 + $dsp_tax_reduced = ( ! empty( $order_tax_reduced ) ) ? usces_crform( $order_tax_reduced, false, false, 'return', false ) : '0';
2095 + $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2096 + ?>
2097 + <tr>
2098 + <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_standard ); ?><span id="include_tax_standard"><?php echo esc_html( $include_tax_standard ); ?></span></td>
2099 + <td class="aright"><input name="order_tax_standard" id="order_tax_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_standard ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2100 + <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2101 + </tr>
2102 + <tr>
2103 + <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_reduced ); ?><span id="include_tax_reduced"><?php echo esc_html( $include_tax_reduced ); ?></span></td>
2104 + <td class="aright"><input name="order_tax_reduced" id="order_tax_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_reduced ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2105 + <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2106 + </tr>
2107 + <tr>
2108 + <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2109 + <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>" readonly /></td>
2110 + <td colspan="2"></td>
2111 + </tr>
2112 + <?php
2113 + endif;
2114 + else :
2115 + if ( 'products' == $tax_target ) :
2116 + $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2117 + ?>
2118 + <tr>
2119 + <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2120 + <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2121 + <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2122 + </tr>
2123 + <?php
2124 + endif;
2125 + endif;
2126 + $dsp_shipping_charge = ( isset( $data['order_shipping_charge'] ) && ! empty( $data['order_shipping_charge'] ) ) ? usces_crform( $data['order_shipping_charge'], false, false, 'return', false ) : '0';
2127 + $dsp_cod_fee = ( isset( $data['order_cod_fee'] ) && ! empty( $data['order_cod_fee'] ) ) ? usces_crform( $data['order_cod_fee'], false, false, 'return', false ) : '0';
2128 + ?>
2129 + <tr>
2130 + <td colspan="5" class="aright"><?php esc_html_e( 'Shipping', 'usces' ); ?></td>
2131 + <td class="aright"><input name="offer[shipping_charge]" id="order_shipping_charge" class="text price" type="text" value="<?php echo esc_attr( $dsp_shipping_charge ); ?>" /></td>
2132 + <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2133 + </tr>
2134 + <tr>
2135 + <td colspan="5" class="aright"><?php echo apply_filters( 'usces_filter_cod_label', __( 'COD fee', 'usces' ), $order_id ); ?></td>
2136 + <td class="aright"><input name="offer[cod_fee]" id="order_cod_fee" class="text price" type="text" value="<?php echo esc_attr( $dsp_cod_fee ); ?>" /></td>
2137 + <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2138 + </tr>
2139 + <?php
2140 + if ( $reduced_taxrate ) :
2141 + if ( 'all' == $tax_target ) :
2142 + if ( 'exclude' == $tax_mode ) {
2143 + if ( empty( $order_tax_standard ) && empty( $order_tax_reduced ) ) {
2144 + $order_tax_standard = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? $data['order_tax'] : 0;
2145 + }
2146 + $msg_notice = __( 'It will be not caluculated automatically.', 'usces' );
2147 + } else {
2148 + $msg_notice = '';
2149 + }
2150 + $dsp_tax_standard = ( ! empty( $order_tax_standard ) ) ? usces_crform( $order_tax_standard, false, false, 'return', false ) : '0';
2151 + $dsp_tax_reduced = ( ! empty( $order_tax_reduced ) ) ? usces_crform( $order_tax_reduced, false, false, 'return', false ) : '0';
2152 + $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2153 + ?>
2154 + <tr>
2155 + <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_standard ); ?><span id="include_tax_standard"><?php echo esc_html( $include_tax_standard ); ?></span></td>
2156 + <td class="aright"><input name="order_tax_standard" id="order_tax_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_standard ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2157 + <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2158 + </tr>
2159 + <tr>
2160 + <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_reduced ); ?><span id="include_tax_reduced"><?php echo esc_html( $include_tax_reduced ); ?></span></td>
2161 + <td class="aright"><input name="order_tax_reduced" id="order_tax_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_reduced ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2162 + <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2163 + </tr>
2164 + <tr>
2165 + <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2166 + <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>" readonly /></td>
2167 + <td colspan="2"></td>
2168 + </tr>
2169 + <?php
2170 + endif;
2171 + else :
2172 + if ( 'all' == $tax_target ) :
2173 + $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2174 + ?>
2175 + <tr>
2176 + <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2177 + <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2178 + <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2179 + </tr>
2180 + <?php
2181 + endif;
2182 + endif;
2183 + $dsp_usedpoint = ( isset( $data['order_usedpoint'] ) && ! empty( $data['order_usedpoint'] ) ) ? $data['order_usedpoint'] : '0';
2184 + $dsp_getpoint = ( isset( $data['order_getpoint'] ) && ! empty( $data['order_getpoint'] ) ) ? $data['order_getpoint'] : '0';
2185 + ?>
2186 + <tr>
2187 + <td colspan="5" class="aright"><?php esc_html_e( 'Used points', 'usces' ); ?></td>
2188 + <td class="aright"><input name="offer[usedpoint]" id="order_usedpoint" class="text price red" type="text" value="<?php echo esc_attr( $dsp_usedpoint ); ?>"<?php echo esc_html( $usedpoint_readonly ); ?> /></td>
2189 + <td><?php esc_html_e( 'granted points', 'usces' ); ?></td>
2190 + <td class="aright"><input name="offer[getpoint]" id="order_getpoint" class="text price" type="text" value="<?php echo esc_attr( $dsp_getpoint ); ?>"<?php echo esc_html( $getpoint_readonly ); ?> /></td>
2191 + </tr>
2192 + <?php
2193 + if ( $reduced_taxrate && 'all' == $tax_target ) :
2194 + $dsp_subtotal_standard = ( ! empty( $order_subtotal_standard ) ) ? usces_crform( $order_subtotal_standard, false, false, 'return', false ) : '0';
2195 + $dsp_subtotal_reduced = ( ! empty( $order_subtotal_reduced ) ) ? usces_crform( $order_subtotal_reduced, false, false, 'return', false ) : '0';
2196 + ?>
2197 + <tr>
2198 + <th colspan="5" class="aright"><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></th>
2199 + <th id="subtotal_standard" class="aright">&nbsp;</th>
2200 + <th colspan="2"><input type="hidden" name="order_subtotal_standard" id="order_subtotal_standard" value="<?php echo esc_attr( $dsp_subtotal_standard ); ?>">&nbsp;</th>
2201 + </tr>
2202 + <tr>
2203 + <th colspan="5" class="aright"></span><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></th>
2204 + <th id="subtotal_reduced" class="aright">&nbsp;</th>
2205 + <th colspan="2"><input type="hidden" name="order_subtotal_reduced" id="order_subtotal_reduced" value="<?php echo esc_attr( $dsp_subtotal_reduced ); ?>">&nbsp;</th>
2206 + </tr>
2207 + <?php
2208 + endif;
2209 + ?>
2210 + <tr>
2211 + <th colspan="5" class="aright"><?php esc_html_e( 'Total Amount', 'usces' ); ?></th>
2212 + <th id="total_full" class="aright">&nbsp;</th>
2213 + <th colspan="2"><input name="recalc" id="recalc" class="button" type="button" value="<?php esc_attr_e( 'Recalculation', 'usces' ); ?>" /><?php wel_esc_script_e( $change_taxrate ); ?></th>
2214 + </tr>
2215 + </tfoot>
2216 +</table>
2217 +<?php
2218 +$cart_table = ob_get_contents();
2219 +ob_end_clean();
2220 +echo apply_filters( 'usces_filter_ordereditform_carttable', $cart_table, $filter_args );
2221 +?>
2222 +</div>
2223 +<?php
2224 +if ( $reduced_taxrate ) :
2225 + ?>
2226 + <div class="order_edit_notice_reduced_tax_rate"><span class="reduced_taxrate_mark"><?php echo esc_html( $usces_tax->reduced_taxrate_mark ); ?></span><?php esc_html_e( ' is reduced tax rate', 'usces' ); ?></div>
2227 + <?php
2228 +endif;
2229 +?>
2230 +<div class="usces_tablenav usces_tablenav_bottom">
2231 +<div class="ordernavi"><input name="update_order_edit2" class="button button-primary" type="submit" value="<?php esc_attr_e( 'change decision', 'usces' ); ?>" /><?php esc_html_e( "When you change amount, please click 'Edit' before you finish your process.", 'usces' ); ?></div>
2232 +</div>
2233 +
2234 +<?php if ( 'new' !== $order_action ) : ?>
2235 +<div class="metabox-holder wp-core-ui ">
2236 + <?php do_meta_boxes( 'order', 'edit', $data ); ?>
2237 +</div>
2238 +<?php endif; ?>
2239 +
2240 +<input name="order_action" type="hidden" value="<?php echo esc_attr( $oa ); ?>" />
2241 +<input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr( $dsp_order_id ); ?>" />
2242 +<input name="old_getpoint" type="hidden" value="<?php echo esc_attr( $hdn_getpoint ); ?>" />
2243 +<input name="old_usedpoint" type="hidden" value="<?php echo esc_attr( $hdn_usedpoint ); ?>" />
2244 +<input name="up_modified" id="up_modified" type="hidden" value="" />
2245 +<?php $hdn_modified = ( isset( $data['order_modified'] ) ) ? $data['order_modified'] : ''; ?>
2246 +<input name="modified" id="modified" type="hidden" value="<?php echo esc_attr( $hdn_modified ); ?>" />
2247 +
2248 +<div id="dialog_parent" style="position:fixed"></div>
2249 +<div id="addItemDialog" title="<?php esc_attr_e( 'Add item', 'usces' ); ?>">
2250 + <div id="order-response"></div>
2251 + <fieldset>
2252 + <div class="clearfix">
2253 + <div class="dialogsearch">
2254 + <label><?php esc_html_e( 'Item Category', 'usces' ); ?></label>
2255 + <?php
2256 + $idobj = get_category_by_slug( 'item' );
2257 + $dropdown_options = apply_filters( 'usces_filter_ordereditform_dropdown_options', array( 'show_option_none' => __( 'Select a category', 'usces' ), 'name' => 'newitemcategory', 'id' => 'newitemcategory', 'hide_empty' => 1, 'hierarchical' => 1, 'orderby' => 'name', 'child_of' => $idobj->term_id ) );
2258 + wp_dropdown_categories( $dropdown_options );
2259 + ?>
2260 + <br />
2261 + <label><?php esc_html_e( 'Item to be added', 'usces' ); ?></label><select name="newitemcode" id="newitemcode"></select><br />
2262 + <div id="loading"></div>
2263 + <label for="name"><?php esc_html_e( 'item code', 'usces' ); ?></label>
2264 + <input type="text" name="newitemcodein" id="newitemcodein" class="text" />
2265 + <input name="getitem" id="getitembutton" type="button" class="button" value="<?php esc_attr_e( 'Obtain', 'usces' ); ?>" onclick="if( jQuery('#newitemcodein').val() == '' ) return; orderItem.getitem(encodeURIComponent(jQuery('#newitemcodein').val()));" />
2266 + </div>
2267 + <div id="newitemform"></div>
2268 + </div>
2269 + </fieldset>
2270 +</div>
2271 +
2272 +<div id="mailSendDialog" title="">
2273 + <div id="order-response"></div>
2274 + <fieldset>
2275 + <p><?php esc_html_e( "Check the mail and click 'send'", 'usces' ); ?></p>
2276 + <label><?php esc_html_e( 'e-mail adress', 'usces' ); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
2277 + <label><?php esc_html_e( 'Client name', 'usces' ); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
2278 + <label><?php esc_html_e( 'subject', 'usces' ); ?></label><input type="text" name="sendmailsubject" id="sendmailsubject" class="text" /><br />
2279 + <?php if ( 1 === (int) $this->options['email_attach_feature'] ) { ?>
2280 + <label><?php esc_html_e( 'Attachment file', 'usces' ); ?></label><input type="file" name="sendmailattachfile" id="sendmailattachfile" class="text" />
2281 + <div class="attachment-extension">
2282 + <?php
2283 + if ( $this->options['email_attach_file_size'] > 0 ) {
2284 + esc_html_e( 'Maximum size of email attachment', 'usces' );
2285 + echo ': ' . $this->options['email_attach_file_size'] . 'MB. ';
2286 + }
2287 + if ( ! empty( $email_attach_file_extension ) ) {
2288 + esc_html_e( 'File extension support', 'usces' );
2289 + echo ' (' . implode( ',', $email_attach_file_extension ) . ')';
2290 + }
2291 + ?>
2292 + </div>
2293 + <?php } ?>
2294 + <?php if ( 1 === (int) $add_html_email_option ) { ?>
2295 + <div id="wrap_load_rich_editor" style="margin-top: 10px">
2296 + <div id="loading_iframe"></div>
2297 + <iframe style="display:none" width="<?php echo esc_attr( $mailsenddialog_width - 40 ); ?>" height="700" id="iframeLoadEditor" src="" ></iframe>
2298 + </div>
2299 + <?php } else { ?>
2300 + <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
2301 + <?php } ?>
2302 + <input name="mailChecked" id="mailChecked" type="hidden" />
2303 + </fieldset>
2304 +</div>
2305 +
2306 +<?php if ( 1 === (int) $add_html_email_option ) { ?>
2307 +<div id="previewEmailDialog" title="">
2308 + <iframe src="" width="<?php echo esc_attr( $mailsenddialog_width - 40 ); ?>" height="4000" frameborder="0" class="content_email_preview" id='iframePreviewEmail'></iframe>
2309 +</div>
2310 +<?php } ?>
2311 +
2312 +<div id="mailSendAlert" title="">
2313 + <div id="order-response"></div>
2314 + <fieldset>
2315 + </fieldset>
2316 +</div>
2317 +<input name="usces_referer" type="hidden" id="usces_referer" value="<?php echo esc_url( $usces_referer ); ?>" />
2318 +<?php wp_nonce_field( 'order_edit', 'wc_nonce' ); ?>
2319 +</form>
2320 +
2321 +<div id="PDFDialog" title="">
2322 + <div id="pdf_response"></div>
2323 + <fieldset>
2324 + <div id="new_pdf"></div>
2325 + </fieldset>
2326 +</div>
2327 +<?php do_action( 'usces_action_endof_order_edit_form', $data, $action_args ); ?>
2328 +</div><!--usces_admin-->
2329 +</div><!--wrap-->