PluginProbe
Welcart e-Commerce / 1.3.6
Welcart e-Commerce v1.3.6
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
usc-e-shop / includes / order_edit_form.php

order_edit_form.php in Welcart e-Commerce 1.3.6, at includes/order_edit_form.php

1,301 lines 55.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $delivery_after_days = apply_filters( 'usces_filter_delivery_after_days', ( !empty($usces->options['delivery_after_days']) ? (int)$usces->options['delivery_after_days'] : 100 ) );//20130527ysk 0000710
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 = explode("\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 WP_ADMIN.'?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 WP_ADMIN.'?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 WP_ADMIN.'?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 WP_ADMIN.'?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 �力して下さい。');
420 obj.focus();
421 return false;
422 }
423 }
424
425 var p = $("input[name*='skuPrice']");
426 var q = $("input[name*='quant']");
427 var t = $("td[id*='sub_total']");
428 var db = $("input[name*='delButton']");
429 var price = [];
430 var quant = [];
431 var sub_total = <?php echo apply_filters('order_edit_form_sub_total', 0, $data); ?>;
432 var total_full = 0;
433 for( var i = 0; i < p.length; i++) {
434 v = parseFloat($(p[i]).val()) * $(q[i]).val();
435 $(t[i]).html(addComma(v+''));
436 //$(t[i]).html(v);
437 sub_total += v;
438 }
439 $("#item_total").html(addComma(sub_total+''));
440 var order_usedpoint = $("#order_usedpoint").val()*1;
441 var order_discount = parseFloat($("#order_discount").val());
442 var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
443 var order_cod_fee = parseFloat($("#order_cod_fee").val());
444 var order_tax = parseFloat($("#order_tax").val());
445 total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
446 $("#total_full").html(addComma(total_full+''));
447 $("#total_full_top").html(addComma(total_full+''));
448 <?php do_action( 'order_edit_form_sumPrice',$data); ?>
449 },
450 make_delivery_time : function(selected) {
451 var option = '';
452 if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
453 option += '<option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>' + "\n";
454 }else{
455 for(var i=0; i<delivery_time[selected].length; i++){
456 if( delivery_time[selected][i] == selected_delivery_time ) {
457 option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
458 }else{
459 option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
460 }
461 }
462 }
463 $("#delivery_time_select").html(option);
464
465 },
466 getMember : function( email ) {
467 var s = orderfunc.settings;
468 s.url = uscesL10n.requestFile;
469 s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email);
470 s.success = function(data, dataType){
471 var values = data.split('#usces#');
472 if( 'ok' == values[0]){
473 for(var i=1; i<values.length; i++){
474 var val = values[i].split('=');
475 if( 'member_id' == val[0] ){
476 $("#member_id_label").html(val[1]);
477 $("#member_id").val(val[1]);
478 }else{
479 $(":input[name='" + val[0] + "']").val(val[1]);
480 }
481 }
482 }else if( 'none' == values[0]){
483 alert( '該当する会員�
484 報は存在しません。' );
485 }else{
486 alert( 'ERROR' );
487 }
488 };
489 s.error = function(data, dataType){
490 alert( 'ERROR' );
491 };
492 $.ajax( s );
493 return false;
494 },
495 recalculation : function() {
496 <?php $script = "
497 var p = $(\"input[name*='skuPrice']\");
498 var q = $(\"input[name*='quant']\");
499 var post_ids = '';
500 var skus = '';
501 var prices = '';
502 var quants = '';
503 for( var i = 0; i < p.length; i++) {
504 name = $(p[i]).attr(\"name\");
505 strs = name.split('[');
506 post_ids += strs[2].replace(/[\]]+$/g, '')+'#usces#';
507 skus += strs[3].replace(/[\]]+$/g, '')+'#usces#';
508 prices += parseFloat($(p[i]).val())+'#usces#';
509 quants += $(q[i]).val()+'#usces#';
510 }
511 var order_usedpoint = $(\"#order_usedpoint\").val()*1;
512 var order_shipping_charge = parseFloat($(\"#order_shipping_charge\").val());
513 var order_cod_fee = parseFloat($(\"#order_cod_fee\").val());
514 var s = orderfunc.settings;
515 s.url = uscesL10n.requestFile;
516 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;
517 s.success = function(data, dataType) {
518 var values = data.split('#usces#');
519 if( 'ok' == values[0] ) {
520 $(\"#order_discount\").val(values[1]);
521 $(\"#order_tax\").val(values[2]);
522 $(\"#order_getpoint\").val(values[3]);
523 $(\"#total_full\").html(addComma(values[4]+''));
524 $(\"#total_full_top\").html(addComma(values[4]+''));
525 } else {
526 alert( 'ERROR' );
527 }
528 };
529 s.error = function(data, dataType) {
530 alert( 'ERROR' );
531 };
532 $.ajax( s );
533 return false;
534 ";
535 echo apply_filters( 'order_edit_form_recalculation',$script, $data);
536 ?>
537 },
538 settings: {
539 url: uscesL10n.requestFile,
540 type: 'POST',
541 cache: false,
542 success: function(data, dataType){
543 },
544 error: function(msg){
545 //$("#ajax-response").html(msg);
546 }
547 }
548 };
549
550 uscesMail = {
551 sendmail : function() {
552 if($("#sendmailaddress").val() == "") return;
553
554 var address = encodeURIComponent($("#sendmailaddress").val());
555 var message = encodeURIComponent($("#sendmailmessage").val());
556 var name = encodeURIComponent($("#sendmailname").val());
557 var subject = encodeURIComponent($("#sendmailsubject").val());
558 var order_id = $("#order_id").val();
559 var checked = $("#mailChecked").val();
560
561 var s = uscesMail.settings;
562 s.data = "action=order_item_ajax&mode=sendmail&mailaddress=" + address + "&message=" + message + "&name=" + name + "&subject=" + subject + "&order_id=" + order_id + "&checked=" + checked;
563 s.success = function(data, dataType){
564 if(data == 'success') {
565 if(checked == 'completionmail'){
566 $("input[name='check\[completionmail\]']").attr({checked: true});
567 }else if(checked == 'ordermail'){
568 $("input[name='check\[ordermail\]']").attr({checked: true});
569 }else if(checked == 'changemail'){
570 $("input[name='check\[changemail\]']").attr({checked: true});
571 }else if(checked == 'receiptmail'){
572 $("input[name='check\[receiptmail\]']").attr({checked: true});
573 }else if(checked == 'mitumorimail'){
574 $("input[name='check\[mitumorimail\]']").attr({checked: true});
575 }else if(checked == 'cancelmail'){
576 $("input[name='check\[cancelmail\]']").attr({checked: true});
577 }else if(checked == 'othermail'){
578 $("input[name='check\[othermail\]']").attr({checked: true});
579 }
580 <?php echo apply_filters('usces_filter_order_check_mail_js', '' ); ?>
581
582 $('#mailSendAlert').dialog('option', 'buttons', {
583 'OK': function() {
584 $(this).dialog('close');
585 $('#mailSendDialog').dialog('close');
586 }
587 });
588 $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
589 $('#mailSendAlert fieldset').html('<p><?php _e('E-mail has been sent.', 'usces'); ?></p>');
590 $('#mailSendAlert').dialog('open');
591
592 }else if(data == 'error'){
593 $('#mailSendAlert').dialog('option', 'buttons', {
594 'OK': function() {
595 $(this).dialog('close');
596 }
597 });
598 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
599 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
600 $('#mailSendAlert').dialog('open');
601 }
602 };
603 s.error = function(data, dataType){
604 $('#mailSendAlert').dialog('option', 'buttons', {
605 'OK': function() {
606 $(this).dialog('close');
607 }
608 });
609 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
610 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
611 $('#mailSendAlert').dialog('open');
612 };
613 $.ajax( s );
614 return false;
615 },
616 ordercheckpost : function( checked ) {
617 var p = uscesMail.settings;
618 var order_id = $("#order_id").val();
619 p.url = uscesL10n.requestFile;
620 p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked;
621 p.success = function(data, dataType){
622 if(data == 'mitumoriprint'){
623 $("input[name='check\[mitumoriprint\]']").attr({checked: true});
624 }else if(data == 'nohinprint'){
625 $("input[name='check\[nohinprint\]']").attr({checked: true});
626 }
627 <?php echo apply_filters('usces_filter_order_check_print_js', '' ); ?>
628 };
629 p.error = function(data, dataType){
630 //$("#ajax-response").html(msg);
631 };
632 $.ajax( p );
633 return false;
634 },
635 settings: {
636 url: uscesL10n.requestFile,
637 type: 'POST',
638 cache: false,
639 success: function(data, dataType){
640 },
641 error: function(msg){
642 //$("#ajax-response").html(msg);
643 }
644 }
645 };
646
647 $('form').submit(function() {
648 var error = 0;
649
650 if( !checkNum( $("#order_usedpoint").val() ) ) {
651 error++;
652 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
653 $(this).css({'background-color': '#FFF'});
654 });
655 }
656 if( !checkNum( $("#order_getdpoint").val() ) ) {
657 error++;
658 $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
659 $(this).css({'background-color': '#FFF'});
660 });
661 }
662 if( !checkPrice( $("#order_discount").val() ) ) {
663 error++;
664 $("#order_discount").css({'background-color': '#FFA'}).click(function() {
665 $(this).css({'background-color': '#FFF'});
666 });
667 }
668 if( !checkPrice( $("#order_shipping_charge").val() ) ) {
669 error++;
670 $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
671 $(this).css({'background-color': '#FFF'});
672 });
673 }
674 if( !checkPrice( $("#order_cod_fee").val() ) ) {
675 error++;
676 $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
677 $(this).css({'background-color': '#FFF'});
678 });
679 }
680 if( !checkPrice( $("#order_tax").val() ) ) {
681 error++;
682 $("#order_tax").css({'background-color': '#FFA'}).click(function() {
683 $(this).css({'background-color': '#FFF'});
684 });
685 }
686
687 if( 0 < error ) {
688 $("#aniboxStatus").removeClass("none");
689 $("#aniboxStatus").addClass("error");
690 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
691 $("#info_massage").html("データに不備があります");
692 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
693 return false;
694 } else {
695 return true;
696 }
697 });
698 <?php do_action('usces_action_order_edit_page_js', $order_id, $data ); ?>
699 <?php echo apply_filters('usces_filter_order_edit_page_js', '', $order_id ); ?>
700 });
701
702 function toggleVisibility(id) {
703 var e = document.getElementById(id);
704 if(e.style.display == 'block') {
705 e.style.display = 'none';
706 //document.getElementById("searchSwitchStatus").value = 'OFF';
707 } else {
708 e.style.display = 'block';
709 //document.getElementById("searchSwitchStatus").value = 'ON';
710 //document.getElementById("searchVisiLink").style.display = 'none';
711 }
712 };
713
714 function addComma(str)
715 {
716 var strs = str.split('.');
717 cnt = 0;
718 n = "";
719 //20120606ysk start 0000497
720 m = "";
721 if( strs[0].substr(0, 1) == "-" ) {
722 m = "-";
723 strs[0] = strs[0].substr(1);
724 }
725 //20120606ysk end
726 for (i=strs[0].length-1; i>=0; i--)
727 {
728 n = strs[0].charAt(i) + n;
729 cnt++;
730 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
731 }
732 n = m + n;//20120606ysk 0000497
733 if(undefined != strs[1]){
734 res = n + '.' + strs[1];
735 }else{
736 res = n;
737 }
738 return res;
739 };
740
741 function pdfWindow( type ) {
742 var wx = 800;
743 var wy = 900;
744 var x = (screen.width- wx) / 2;
745 var y = (screen.height - wy) / 2;
746 x = 0;
747 y = 0;
748 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");
749 }
750 //20120606ysk start 0000497
751 function checkNumMinus( argValue ) {
752 if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
753 return false;
754 }
755 return true;
756 }
757 //20120606ysk end
758 //20120307ysk start 0000432
759 function delConfirm(){
760 if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
761 return true;
762 }else{
763 return false;
764 }
765 }
766 //20120307ysk end
767
768 jQuery(document).ready(function($){
769 //20120528ysk start 0000485
770 // var p = $("input[name*='skuPrice']");
771 // var q = $("input[name*='quant']");
772 // var t = $("td[id*='sub_total']");
773 // var db = $("input[name*='delButton']");
774
775 orderfunc.sumPrice(null);
776
777 // for( var i = 0; i < p.length; i++) {
778 // $(p[i]).bind("change", function(){ orderfunc.sumPrice($(p[i])); });
779 // $(q[i]).bind("change", function(){ orderfunc.sumPrice($(q[i])); });
780 // $(db[i]).bind("click", function(){ return delConfirm($(db[i])); });
781 // }
782 $("input[name*='skuPrice']").bind("change", function(){ orderfunc.sumPrice($(this)); });
783 $("input[name*='quant']").bind("change", function(){ orderfunc.sumPrice($(this)); });
784 $("input[name*='delButton']").bind("click", function(){ orderfunc.sumPrice(null); });
785 //20120528ysk end
786 $("#order_usedpoint").bind("change", function(){ orderfunc.sumPrice($("#order_usedpoint")); });
787 $("#order_discount").bind("change", function(){ orderfunc.sumPrice($("#order_discount")); });
788 $("#order_shipping_charge").bind("change", function(){ orderfunc.sumPrice($("#order_shipping_charge")); });
789 $("#order_cod_fee").bind("change", function(){ orderfunc.sumPrice($("#order_cod_fee")); });
790 $("#order_tax").bind("change", function(){ orderfunc.sumPrice($("#order_tax")); });
791 $("input[name*='upButton']").click(function(){
792 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() ){
793 if( confirm("<?php _e("更新日を今日の日付に変更しますか?", 'usces'); ?>\n<?php _e("更新日を変更せずに更新する場合はキャンセルを押してください。", 'usces'); ?>") ){
794 $('#up_modified').val('update');
795 }else{
796 $('#up_modified').val('');
797 }
798 }
799 return true;
800 });
801
802 //20120307ysk start 0000432
803 //function delConfirm(){
804 // if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
805 // return true;
806 // }else{
807 // return false;
808 // }
809 //}
810 //20120307ysk end
811
812 orderfunc.make_delivery_time(<?php echo $order_delivery_method; ?>);
813
814 $("#get_member").click(function(){
815 if( '' == $("input[name='customer[mailaddress]']").val() ){
816 alert('e-mail を�
817 �力して下さい。');
818 return;
819 }
820 if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
821 //20120914ysk start 0000567
822 //if( confirm('顧客�
823 報、発送�
824 ��
825 報を上書きします。よろしいですか?') ){
826 if( !confirm('顧客�
827 報、発送�
828 ��
829 報を上書きします。よろしいですか?') ){
830 //orderfunc.getMember($("input[name='customer[mailaddress]']").val());
831 return;
832 }
833 }
834 orderfunc.getMember($("input[name='customer[mailaddress]']").val());
835 //20120914ysk end
836 });
837 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
838 $("#costomercopy").click(function() {
839 if( '' != $("input[name='delivery[name1]']").val() ||
840 '' != $("input[name='delivery[name2]']").val() ||
841 '' != $("input[name='delivery[name3]']").val() ||
842 '' != $("input[name='delivery[name4]']").val() ||
843 '' != $("input[name='delivery[zipcode]']").val() ||
844 '' != $("input[name='delivery[address1]']").val() ||
845 '' != $("input[name='delivery[address2]']").val() ||
846 '' != $("input[name='delivery[address3]']").val() ||
847 '' != $("input[name='delivery[tel]']").val() ||
848 '' != $("input[name='delivery[fax]']").val() ) {
849 if( !confirm('顧客住所を発送�
850 �住所に上書きします。よろしいですか?') )
851 return;
852 }
853 $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
854 $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
855 $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
856 $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
857 $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
858 $("#delivery_country").val($("#customer_country option:selected").val());
859 $("#delivery_pref").val($("#customer_pref option:selected").val());
860 $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
861 $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
862 $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
863 $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
864 $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
865 });
866 <?php endif;//20120319ysk end ?>
867
868 $("#recalc").click(function(){ orderfunc.recalculation(); });
869 });
870 </script>
871 <div class="wrap">
872 <div class="usces_admin">
873 <form action="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action='.$oa; ?>" method="post" name="editpost">
874
875 <h2>Welcart Management <?php _e('Edit order data','usces'); ?></h2>
876 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
877 <div id="aniboxStatus" class="<?php echo $status; ?>">
878 <div id="anibox" class="clearfix">
879 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
880 <div class="mes" id="info_massage"><?php echo $message; ?></div>
881 </div>
882 </div>
883 <div class="mailVisiLink">
884 <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>
885 </div>
886 <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>
887 <div id="mailBox">
888 <table>
889 <tr>
890 <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>
891 <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>
892 <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>
893 <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>
894 <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>
895 <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>
896 </tr>
897 <tr>
898 <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>
899 <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>
900 <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>
901 <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>
902 <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>
903 <?php echo apply_filters('usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
904 </tr>
905 <tr>
906 <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>
907 </tr>
908 </table>
909 </div>
910 <div class="info_head">
911 <table>
912 <tr>
913 <td colspan="6" class="midasi0"><?php _e('order details', 'usces'); ?></td>
914 </tr>
915 <tr>
916 <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>
917 <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>
918 <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>
919 </tr>
920 <tr>
921 <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>
922 <td colspan="2" rowspan="10" class="wrap_td">
923 <table border="0" cellspacing="0" class="cus_info">
924 <tr>
925 <td class="label">e-mail</td>
926 <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="会員�
927 報取込" /></td>
928 </tr>
929
930 <?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
931
932 </table></td>
933 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
934 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?><input type="button" id="costomercopy" value="発送�
935 �同じ"></td>
936 <?php else : ?>
937 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?></td>
938 <?php endif;//20120319ysk end ?>
939 </tr>
940 <tr>
941 <td class="label"><?php _e('payment method', 'usces'); ?></td>
942 <td class="col1"><select name="offer[payment_name]" id="order_payment_name">
943 <option value="#none#"><?php _e('-- Select --', 'usces'); ?></option>
944 <?php
945 if( $payment_method ) {
946 foreach ((array)$payment_method as $payments) {
947 if( $payments['name'] != '' ) {
948 $selected = (isset($data['order_payment_name']) && $payments['name'] == $data['order_payment_name']) ? ' selected="selected"' : '';
949 ?>
950 <option value="<?php echo esc_attr($payments['name']); ?>"<?php echo $selected; ?>><?php echo esc_attr($payments['name']); ?></option>
951 <?php } } } ?>
952 </select></td>
953 <td colspan="2" rowspan="9" class="wrap_td">
954 <table border="0" cellspacing="0" class="deli_info">
955
956 <?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
957
958 </table></td>
959 </tr>
960 <tr>
961 <td class="label"><?php _e('shipping option','usces'); ?></td>
962 <td class="col1"><select name="offer[delivery_method]" id="delivery_method_select">
963 <option value="-1"><?php _e('Non-request', 'usces'); ?></option>
964 <?php
965 foreach ((array)$this->options['delivery_method'] as $dkey => $delivery) {
966 $selected = $order_delivery_method == $delivery['id'] ? ' selected="selected"' : '';
967 echo "\t<option value='" . esc_attr($delivery['id']) . "'{$selected}>" . esc_attr($delivery['name']) . "</option>\n";
968 }
969 ?>
970 </select></td>
971 <?php //if( USCES_JP ): ?>
972 </tr>
973 <?php //endif; ?>
974 <!--20101208ysk start-->
975 <tr>
976 <td class="label"><?php _e('Delivery date', 'usces'); ?></td>
977 <td class="col1"><select name="offer[delivery_date]" id="delivery_date_select">
978 <?php
979 $delivery_days_select = '<option value="'.__('Non-request', 'usces').'">'.__('Non-request', 'usces').'</option>';
980 $data_order_date = explode(" ", $data['order_date']);
981 $order_date = explode("-", $data_order_date[0]);
982 //for($i = 0; $i < 50; $i++) {
983 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
984 $value = date('Y-m-d', mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
985 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
986 $selected = (isset($data['order_delivery_date']) && $data['order_delivery_date'] == $value) ? ' selected="selected"' : '';
987 $delivery_days_select .= '<option value="'.$value.'"'.$selected.'>'.$date.'</option>';
988 }
989 ?>
990 <?php echo apply_filters( 'usces_filter_order_edit_delivery_days_select', $delivery_days_select, $data, $delivery_after_days ); ?>
991 </select></td>
992 </tr>
993 <!--20101208ysk end-->
994 <tr>
995 <td class="label"><?php _e('delivery time', 'usces'); ?></td>
996 <td class="col1">
997 <select name="offer[delivery_time]" id="delivery_time_select">
998 <option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>
999 </select>
1000 </td>
1001 </tr>
1002 <tr>
1003 <td class="label"><?php _e('Shipping date', 'usces'); ?></td>
1004 <td class="col1"><select name="offer[delidue_date]">
1005 <option value="#none#"><?php _e('Not notified', 'usces'); ?></option>
1006 <?php
1007 //for ($i=0; $i<50; $i++) {
1008 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
1009 $value = date('Y-m-d', mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
1010 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
1011 $selected = (isset($data['order_delidue_date']) && $data['order_delidue_date'] == $value) ? ' selected="selected"' : '';
1012 echo "\t<option value='{$value}'{$selected}>{$date}</option>\n";
1013 }
1014 ?>
1015 </select></td>
1016 </tr>
1017 <tr>
1018 <td colspan="2" class="midasi3"><?php _e('Status', 'usces'); ?></td>
1019 </tr>
1020 <tr>
1021 <td class="label status"><?php _e('The correspondence situation', 'usces'); ?></td>
1022 <td class="col1 status">
1023 <select name="offer[taio]" id="order_taio">
1024 <option value='#none#'><?php _e('new order', 'usces'); ?></option>
1025 <?php
1026 foreach ($management_status as $status_key => $status_name){
1027 if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
1028 continue;
1029 ?>
1030 <option value="<?php echo $status_key; ?>"<?php if($taio == $status_key){ echo ' selected="selected"';} ?>><?php echo $status_name; ?></option>
1031 <?php
1032 }
1033 ?>
1034 </select></td>
1035 </tr>
1036 <tr>
1037 <td class="label status" id="receiptlabel"><?php if($receipt != ''){echo __('transfer statement', 'usces');}else{echo '&nbsp';} ?></td>
1038 <td class="col1 status" id="receiptbox">
1039 <?php if($receipt != '') : ?>
1040 <select name="offer[receipt]">
1041 <option value='noreceipt'<?php if($receipt == 'noreceipt'){ echo ' selected="selected"';} ?>><?php echo $management_status['noreceipt']; ?></option>
1042 <option value='receipted'<?php if($receipt == 'receipted'){ echo ' selected="selected"';} ?>><?php echo $management_status['receipted']; ?></option>
1043 <option value='pending'<?php if($receipt == 'pending'){ echo ' selected="selected"';} ?>><?php echo $management_status['pending']; ?></option>
1044 </select>
1045 <?php else : ?>
1046 &nbsp
1047 <?php endif; ?>
1048 </td>
1049 </tr>
1050 <tr>
1051 <td class="label status"><?php if($admin != ''){echo __('estimate order', 'usces');}else{echo '&nbsp';} ?></td>
1052 <td class="col1 status">
1053 <?php if($admin != '') : ?>
1054 <select name="offer[admin]">
1055 <option value='adminorder'<?php if($admin == 'adminorder'){ echo 'selected="selected"';} ?>><?php echo $management_status['adminorder']; ?></option>
1056 <option value='estimate'<?php if($admin == 'estimate'){ echo 'selected="selected"';} ?>><?php echo $management_status['estimate']; ?></option>
1057 </select>
1058 <?php else : ?>
1059 &nbsp
1060 <?php endif; ?></td>
1061 </tr>
1062 <tr>
1063 <td colspan="2" class="status">
1064 <div class="midasi2"><?php if($condition['display_mode'] == 'Usualsale'){echo __('normal sale', 'usces');}elseif($condition['display_mode'] == 'Promotionsale'){echo __('Sale Campaign', 'usces');} ?></div>
1065 <div class="condition">
1066 <?php if ( $condition['display_mode'] == 'Promotionsale' ) : ?>
1067 <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 />
1068 <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 />
1069 <?php endif; ?>
1070 </div></td>
1071 <td class="label"><?php _e('Notes', 'usces'); ?></td>
1072 <td colspan="3"><textarea name="offer[note]"><?php echo esc_attr(isset($data['order_note']) ? $data['order_note'] : ''); ?></textarea></td>
1073 </tr>
1074 </table>
1075 </div>
1076 <?php //if( $this->has_order_custom_info( $order_id ) ): ?>
1077 <div class="info_head">
1078 <table>
1079 <tr>
1080 <td class="midasi0"><?php _e('Custom order field', 'usces'); ?></td>
1081 <td class="midasi0"><?php _e('Payment information', 'usces'); ?></td>
1082 </tr>
1083 <tr>
1084 <td class="wrap_td">
1085 <table class="order_custom_wrap">
1086 <tr>
1087 <?php do_action( 'usces_action_order_edit_form_custom', $data, $csod_meta ); ?>
1088 <?php
1089 //20100818ysk start
1090 usces_admin_custom_field_input($csod_meta, 'order', '');
1091 //20100818ysk end
1092 ?>
1093 </tr>
1094
1095 </table>
1096 </td>
1097 <td class="wrap_td">
1098 <table class="settle_info_wrap">
1099 <?php usces_settle_info_field( $order_id, 'tr' ); ?>
1100 </table>
1101 </td>
1102 </tr>
1103 </table>
1104 </div>
1105 <?php //endif; ?>
1106 <div id="cart">
1107 <table cellspacing="0" id="cart_table">
1108 <thead>
1109 <tr>
1110 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1111 <th id="total_full_top" class="aright">&nbsp;</th>
1112 <th colspan="2">&nbsp;<?php _e('Currency','usces'); ?>(<?php usces_crcode(); ?>)</th>
1113 </tr>
1114 <tr>
1115 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
1116 <th class="thumbnail"> <?php //echo __('thumbnail','usces'); ?></th>
1117 <th><?php _e('Items','usces'); ?></th>
1118 <th class="price"><?php _e('Unit price','usces'); ?></th>
1119 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
1120 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
1121 <th class="stock"><?php _e('Current stock', 'usces'); ?></th>
1122 <th class="action"><input name="addButton" id="addCartButton" class="addCartButton" type="button" value="<?php _e('Add item', 'usces'); ?>" /></th>
1123 </tr>
1124 </thead>
1125 <tbody id="orderitemlist">
1126 <?php
1127 global $post;
1128 for($i=0; $i<count($cart); $i++) {
1129 $cart_row = $cart[$i];
1130 $post_id = $cart_row['post_id'];
1131 $post = get_post($post_id);
1132 $sku = $cart_row['sku'];
1133 $sku_code = esc_attr(urldecode($cart_row['sku']));
1134 $quantity = $cart_row['quantity'];
1135 $options = $cart_row['options'];
1136 $advance = $this->cart->wc_serialize($cart_row['advance']);
1137 $itemCode = $this->getItemCode($post_id);
1138 $itemName = $this->getItemName($post_id);
1139 $cartItemName = $this->getCartItemName($post_id, $sku_code);
1140 $skuPrice = $cart_row['price'];
1141 $stock = $this->getItemZaiko($post_id, $sku_code);
1142 $red = (in_array($stock, array(__('sellout', 'usces'), __('Out Of Stock', 'usces'), __('Out of print', 'usces')))) ? 'class="signal_red"' : '';
1143 $pictid = (int)$this->get_mainpictid($itemCode);
1144 if( empty($options) ) {
1145 $optstr = '';
1146 $options = array();
1147 }
1148 if( is_array($options) && count($options) > 0 ){
1149 $optstr = '';
1150 foreach($options as $key => $value){
1151 //20110629ysk start 0000190
1152 //if( !empty($key) )
1153 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1154 if( !empty($key) ) {
1155 $key = urldecode($key);
1156 if(is_array($value)) {
1157 $c = '';
1158 $optstr .= esc_html($key) . ' : ';
1159 foreach($value as $v) {
1160 $optstr .= $c.nl2br(esc_html(urldecode($v)));
1161 $c = ', ';
1162 }
1163 $optstr .= "<br />\n";
1164 } else {
1165 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1166 }
1167 }
1168 //20110629ysk end
1169 }
1170 }
1171 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'sku_code', 'quantity', 'options', 'advance',
1172 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'stock', 'red', 'pictid', 'order_id' );
1173 $optstr = apply_filters( 'usces_filter_order_edit_form_row', $optstr, $cart, $materials );
1174 ?>
1175 <tr>
1176 <td><?php echo $i + 1; ?></td>
1177 <td><?php echo wp_get_attachment_image( $pictid, array(150, 150), true ); ?></td>
1178 <td class="aleft"><?php echo esc_html($cartItemName); ?><?php do_action('usces_admin_order_item_name', $order_id, $i); ?><br /><?php echo $optstr; ?></td>
1179 <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>
1180 <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>
1181 <td id="sub_total[<?php echo $i; ?>]" class="aright">&nbsp;</td>
1182 <td <?php echo $red ?>><?php echo esc_html($stock); ?></td>
1183 <td>
1184 <?php foreach((array)$options as $key => $value){ ?>
1185 <input name="optName[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo esc_attr($key); ?>" />
1186 <?php if(is_array($value)): //20110715ysk 0000202 ?>
1187 <?php foreach($value as $v): ?>
1188 <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; ?>" />
1189 <?php endforeach; ?>
1190 <?php else: ?>
1191 <input name="itemOption[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo $value; ?>" />
1192 <?php endif; ?>
1193 <?php } ?>
1194 <input name="advance[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" type="hidden" value="<?php echo esc_attr($advance); ?>" />
1195 <input name="delButton[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="delCartButton" type="submit" value="<?php _e('Delete', 'usces'); ?>" />
1196 <?php do_action('usces_admin_order_cart_button', $order_id, $i); ?>
1197 </td>
1198 </tr>
1199 <?php
1200 }
1201 ?>
1202 </tbody>
1203 <tfoot>
1204 <tr>
1205 <th colspan="5" class="aright"><?php _e('total items','usces'); ?></th>
1206 <th id="item_total" class="aright">&nbsp;</th>
1207 <th colspan="2">&nbsp;</th>
1208 </tr>
1209 <tr>
1210 <td colspan="5" class="aright"><?php _e('Used points','usces'); ?></td>
1211 <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>
1212 <td><?php _e('granted points', 'usces'); ?></td>
1213 <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>
1214 </tr>
1215 <tr>
1216 <td colspan="5" class="aright"><?php echo apply_filters('usces_confirm_discount_label', __('Campaign disnount', 'usces'), $order_id); ?></td>
1217 <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>
1218 <td colspan="2"><?php _e('Discounted amount should be shown by -(Minus)', 'usces'); ?>&nbsp;</td>
1219 </tr>
1220 <tr>
1221 <td colspan="5" class="aright"><?php _e('Shipping', 'usces'); ?></td>
1222 <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>
1223 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1224 </tr>
1225 <tr>
1226 <td colspan="5" class="aright"><?php echo apply_filters('usces_filter_cod_label', __('COD fee', 'usces')); ?></td>
1227 <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>
1228 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1229 </tr>
1230 <tr>
1231 <td colspan="5" class="aright"><?php _e('consumption tax', 'usces'); ?></td>
1232 <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>
1233 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1234 </tr>
1235 <tr>
1236 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1237 <th id="total_full" class="aright">&nbsp;</th>
1238 <th colspan="2"><input name="recalc" id="recalc" class="addCartButton" type="button" value="<?php _e('再計算', 'usces'); ?>" /></th>
1239 </tr>
1240 </tfoot>
1241 </table>
1242 </div>
1243 <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>
1244
1245 <input name="order_action" type="hidden" value="<?php echo $oa; ?>" />
1246 <input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr(isset($data['ID']) ? $data['ID'] : ''); ?>" />
1247 <input name="old_getpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_getpoint']) ? $data['order_getpoint'] : ''); ?>" />
1248 <input name="old_usedpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_usedpoint']) ? $data['order_usedpoint'] : ''); ?>" />
1249 <input name="up_modified" id="up_modified" type="hidden" value="" />
1250 <input name="modified" id="modified" type="hidden" value="<?php echo esc_attr(isset($data['order_modified']) ? $data['order_modified'] : ''); ?>" />
1251
1252
1253
1254
1255 <div id="addItemDialog" title="<?php _e('Add item', 'usces'); ?>">
1256 <div id="order-response"></div>
1257 <fieldset>
1258 <div class="clearfix">
1259 <div class="dialogsearch">
1260 <p><?php _e("Enter the item code, then press 'Obtain'", 'usces'); ?></p>
1261 <label for="name"><?php _e('item code', 'usces'); ?></label>
1262 <input type="text" name="newitemcode" id="newitemcode" class="text" />
1263 <input name="getitem" type="button" value="<?php _e('Obtain', 'usces'); ?>" onclick="if( jQuery('#newitemcode').val() == '' ) return; orderItem.getitem();" />
1264 </div>
1265 <div id="newitemform"></div>
1266 </div>
1267 </fieldset>
1268 </div>
1269
1270
1271
1272 <div id="mailSendDialog" title="">
1273 <div id="order-response"></div>
1274 <fieldset>
1275 <p><?php _e("Check the mail and click 'send'", 'usces'); ?></p>
1276 <label><?php _e('e-mail adress', 'usces'); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
1277 <label><?php _e('Client name', 'usces'); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
1278 <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 />
1279 <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
1280 <input name="mailChecked" id="mailChecked" type="hidden" />
1281 </fieldset>
1282 </div>
1283
1284 <div id="mailSendAlert" title="">
1285 <div id="order-response"></div>
1286 <fieldset>
1287 </fieldset>
1288 </div>
1289 <input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
1290 </form>
1291
1292 <div id="PDFDialog" title="">
1293 <div id="pdf_response"></div>
1294 <fieldset>
1295 <div id="new_pdf"></div>
1296 </fieldset>
1297 </div>
1298
1299 </div><!--usces_admin-->
1300 </div><!--wrap-->
1301