PluginProbe
Welcart e-Commerce / 1.4.0
Welcart e-Commerce v1.4.0
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.4.0, at includes/order_edit_form.php

1,236 lines 52.7 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 $condition = $this->get_condition();
73 $data = array(
74 'mem_name1' => '',
75 'mem_name2' => '',
76 'mem_name3' => '',
77 'mem_name4' => '',
78 'mem_zip' => '',
79 'mem_address1' => '',
80 'mem_address2' => '',
81 'mem_address3' => '',
82 'mem_tel' => '',
83 'mem_fax' => '',
84 'mem_country' => '',
85 'mem_pref' => '',
86 'order_name1' => '',
87 'order_name2' => '',
88 'order_name3' => '',
89 'order_name4' => '',
90 'order_zip' => '',
91 'order_address1' => '',
92 'order_address2' => '',
93 'order_address3' => '',
94 'order_tel' => '',
95 'order_fax' => '',
96 'order_country' => '',
97 'order_pref' => '',
98 'ID' => '',
99 'order_condition' => $condition,
100 'order_date' => current_time('mysql'),
101 'order_delivery_date' => '',
102 );
103 $deli = array(
104 'name1' => '',
105 'name2' => '',
106 'name3' => '',
107 'name4' => '',
108 'zipcode' => '',
109 'address1' => '',
110 'address2' => '',
111 'address3' => '',
112 'tel' => '',
113 'fax' => '',
114 'country' => '',
115 'pref' => ''
116 );
117 $cart = array();
118
119
120 }else{
121
122 $oa = 'editpost';
123
124 $order_id = $_REQUEST['order_id'];
125
126 global $wpdb;
127
128 $tableName = $wpdb->prefix . "usces_order";
129 $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $order_id);
130 $data = $wpdb->get_row( $query, ARRAY_A );
131
132
133
134 $deli = stripslashes_deep(unserialize($data['order_delivery']));
135 $seriarized_cart = stripslashes_deep(unserialize($data['order_cart']));
136 $cart = usces_get_ordercartdata( $order_id );
137 //usces_p($cart);
138 $condition = stripslashes_deep(unserialize($data['order_condition']));
139 $ordercheck = stripslashes_deep(unserialize($data['order_check']));
140 if( !is_array($ordercheck) ) $ordercheck = array();
141 $order_delivery_method = $data['order_delivery_method'];
142
143 if( !empty($data) ){
144 $data = stripslashes_deep($data);
145 }
146 foreach ($management_status as $status_key => $status_name){
147 if( in_array($status_key, array('noreceipt','receipted','pending','estimate', 'adminorder')) )
148 continue;
149
150 if($this->is_status($status_key, $data['order_status'])){
151 $taio = $status_key;
152 break;
153 }else{
154 $taio = 'new';
155 }
156 }
157
158 if($this->is_status('estimate', $data['order_status']))
159 $admin = 'estimate';
160 else if($this->is_status('adminorder', $data['order_status']))
161 $admin = 'adminorder';
162 else
163 $admin = '';
164
165 if($this->is_status('noreceipt', $data['order_status']))
166 $receipt = 'noreceipt';
167 else if($this->is_status('receipted', $data['order_status']))
168 $receipt = 'receipted';
169 else if($this->is_status('pending', $data['order_status']))
170 $receipt = 'pending';
171 else
172 $receipt = '';
173 //20100818ysk start
174 $csod_meta = usces_has_custom_field_meta('order');
175 if(is_array($csod_meta)) {
176 $keys = array_keys($csod_meta);
177 foreach($keys as $key) {
178 $csod_key = 'csod_'.$key;
179 $csod_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csod_key, $order_id));
180 }
181 }
182 $cscs_meta = usces_has_custom_field_meta('customer');
183 if(is_array($cscs_meta)) {
184 $keys = array_keys($cscs_meta);
185 foreach($keys as $key) {
186 $cscs_key = 'cscs_'.$key;
187 $cscs_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($cscs_key, $order_id));
188 }
189 }
190 $csde_meta = usces_has_custom_field_meta('delivery');
191 if(is_array($csde_meta)) {
192 $keys = array_keys($csde_meta);
193 foreach($keys as $key) {
194 $csde_key = 'csde_'.$key;
195 $csde_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csde_key, $order_id));
196 }
197 }
198 //20100818ysk end
199 }
200 $filter_args = compact( 'order_action', 'order_id', 'data', 'cart' );
201 $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
202 ?>
203 <script type="text/javascript">
204 jQuery(function($){
205 <?php if($status == 'success'){ ?>
206 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
207 <?php }else if($status == 'caution'){ ?>
208 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
209 <?php }else if($status == 'error'){ ?>
210 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
211 <?php } ?>
212 var selected_delivery_time = '<?php esc_html_e(isset($data['order_delivery_time']) ? $data['order_delivery_time'] : ''); ?>';
213 var delivery_time = [];
214 <?php
215 foreach((array)$this->options['delivery_method'] as $dmid => $dm){
216 $lines = explode("\n", $dm['time']);
217 ?>
218 delivery_time[<?php echo $dm['id']; ?>] = [];
219 <?php
220 foreach((array)$lines as $line){
221 if(trim($line) != ''){
222 ?>
223 delivery_time[<?php echo $dm['id']; ?>].push("<?php echo trim($line); ?>");
224 <?php }
225 }
226 }
227 ?>
228
229 $("#order_payment_name").change(function () {
230 var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
231 //20101018ysk start
232 //if( uscesPayments[pay_name] == 'transferAdvance' || uscesPayments[pay_name] == 'transferDeferred'){
233 if( uscesPayments[pay_name] == 'transferAdvance'
234 || uscesPayments[pay_name] == 'transferDeferred'
235 || uscesPayments[pay_name] == 'acting_remise_conv'
236 || uscesPayments[pay_name] == 'acting_zeus_bank'
237 || uscesPayments[pay_name] == 'acting_zeus_conv'
238 || uscesPayments[pay_name] == 'acting_jpayment_conv'
239 || uscesPayments[pay_name] == 'acting_jpayment_bank'){
240 //20101018ysk end
241 var label = '<?php _e('transfer statement', 'usces'); ?>';
242 var html = "<select name='offer[receipt]'>\n";
243 html += "<option value='noreceipt'><?php echo $management_status['noreceipt']; ?></option>\n";
244 html += "<option value='receipted'><?php echo $management_status['receipted']; ?></option>\n";
245 html += "</select>\n";
246 $("#receiptlabel").html(label);
247 $("#receiptbox").html(html);
248 <?php do_action( 'usces_change_payment_terms_js', $management_status, $data ); ?>
249 }else{
250 $("#receiptlabel").html('');
251 $("#receiptbox").html('');
252 }
253 });
254
255 $("#addItemDialog").dialog({
256 bgiframe: true,
257 autoOpen: false,
258 height: 500,
259 width: 700,
260 resizable: true,
261 modal: true,
262 buttons: {
263 '<?php _e('close', 'usces'); ?>': function() {
264 $(this).dialog('close');
265 }
266 },
267 close: function() {
268 $("#newitemcategory").val( "-1" );
269 $("#newitemform").html( "" );
270 $('#newitemcode').val('');
271 }
272 });
273 $('#addCartButton').click(function() {
274 if($("input[name='order_id']").val() == ''){
275 alert("<?php _e("Push 'change decision' button, to be settled with an order number.", 'usces'); ?>");
276 return;
277 }
278 $('#addItemDialog').dialog('open');
279 });
280 $('#delivery_method_select').change(function() {
281 orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
282 });
283
284 $("#mailSendDialog").dialog({
285 bgiframe: true,
286 autoOpen: false,
287 height: 650,
288 width: 700,
289 resizable: true,
290 modal: true,
291 buttons: {
292 '<?php _e('close', 'usces'); ?>': function() {
293 $(this).dialog('close');
294 }
295 },
296 close: function() {
297 $("#sendmailmessage").html( "" );
298 $('#sendmailaddress').val('');
299 }
300 });
301 $('#completionMail').click(function() {
302 orderItem.getmailmessage('completionMail');
303 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
304 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
305 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['completionmail'], $data, 'completionMail')); ?>');
306 $('#mailChecked').val('completionmail');
307 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for Shipping', 'usces'); ?>');
308 $('#mailSendDialog').dialog('open');
309 });
310 $('#orderConfirmMail').click(function() {
311 orderItem.getmailmessage('orderConfirmMail');
312 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
313 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
314 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['ordermail'], $data, 'orderConfirmMail')); ?>');
315 $('#mailChecked').val('ordermail');
316 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of order', 'usces'); ?>');
317 $('#mailSendDialog').dialog('open');
318 });
319 $('#changeConfirmMail').click(function() {
320 orderItem.getmailmessage('changeConfirmMail');
321 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
322 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
323 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['changemail'], $data, 'changeConfirmMail')); ?>');
324 $('#mailChecked').val('changemail');
325 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confiemation of change', 'usces'); ?>');
326 $('#mailSendDialog').dialog('open');
327 });
328 $('#receiptConfirmMail').click(function() {
329 orderItem.getmailmessage('receiptConfirmMail');
330 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
331 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
332 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['receiptmail'], $data, 'receiptConfirmMail')); ?>');
333 $('#mailChecked').val('receiptmail');
334 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of transter', 'usces'); ?>');
335 $('#mailSendDialog').dialog('open');
336 });
337 $('#mitumoriConfirmMail').click(function() {
338 orderItem.getmailmessage('mitumoriConfirmMail');
339 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
340 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
341 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['mitumorimail'], $data, 'mitumoriConfirmMail')); ?>');
342 $('#mailChecked').val('mitumorimail');
343 $('#mailSendDialog').dialog('option', 'title', '<?php _e('estimate mail', 'usces'); ?>');
344 $('#mailSendDialog').dialog('open');
345 });
346 $('#cancelConfirmMail').click(function() {
347 orderItem.getmailmessage('cancelConfirmMail');
348 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
349 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
350 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['cancelmail'], $data, 'cancelConfirmMail')); ?>');
351 $('#mailChecked').val('cancelmail');
352 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Cancelling mail', 'usces'); ?>');
353 $('#mailSendDialog').dialog('open');
354 });
355 $('#otherConfirmMail').click(function() {
356 orderItem.getmailmessage('otherConfirmMail');
357 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
358 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
359 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['othermail'], $data, 'otherConfirmMail')); ?>');
360 $('#mailChecked').val('othermail');
361 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Other mail', 'usces'); ?>');
362 $('#mailSendDialog').dialog('open');
363 });
364
365 $("#mailSendAlert").dialog({
366 bgiframe: true,
367 autoOpen: false,
368 height: 200,
369 width: 200,
370 resizable: false,
371 modal: false
372 });
373 $("#sendmail").click(function() {
374 uscesMail.sendmail();
375 });
376
377 $("#PDFDialog").dialog({
378 bgiframe: true,
379 autoOpen: false,
380 height: 800,
381 width: 700,
382 resizable: true,
383 modal: true,
384 buttons: {
385 '<?php _e('close', 'usces'); ?>': function() {
386 $(this).dialog('close');
387 }
388 },
389 close: function() {
390 $("#new_pdf").html( "" );
391 }
392 });
393 $('#mitumoriprint').click(function() {
394 $('#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>');
395 $('#PDFDialog').dialog('option', 'title', '<?php _e('print out the estimate', 'usces'); ?>');
396 $('#PDFDialog').dialog('open');
397 uscesMail.ordercheckpost('mitumoriprint');
398 });
399 $('#nohinprint').click(function() {
400 $('#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>');
401 $('#PDFDialog').dialog('option', 'title', '<?php _e('print out Delivery Statement', 'usces'); ?>');
402 $('#PDFDialog').dialog('open');
403 uscesMail.ordercheckpost('nohinprint');
404 });
405 $('#receiptprint').click(function() {
406 $('#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>');
407 $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Receipt', 'usces'); ?>');
408 $('#PDFDialog').dialog('open');
409 uscesMail.ordercheckpost('receiptprint');
410 });
411 $('#billprint').click(function() {
412 $('#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>');
413 $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Invoice', 'usces'); ?>');
414 $('#PDFDialog').dialog('open');
415 uscesMail.ordercheckpost('billprint');
416 });
417
418 orderfunc = {
419 sumPrice : function(obj) {
420 if(obj != null) {
421 //20120606ysk start 0000497
422 //if(!checkNum(obj.val())) {
423 if(!checkNumMinus(obj.val())) {
424 //20120606ysk end
425 alert('<?php _e("Please enter a numeric value.", "usces"); ?>');
426 obj.focus();
427 return false;
428 }
429 }
430
431 var p = $("input[name*='skuPrice']");
432 var q = $("input[name*='quant']");
433 var t = $("td[id*='sub_total']");
434 var db = $("input[name*='delButton']");
435 var price = [];
436 var quant = [];
437 var sub_total = <?php echo apply_filters('order_edit_form_sub_total', 0, $data); ?>;
438 var total_full = 0;
439 for( var i = 0; i < p.length; i++) {
440 v = parseFloat($(p[i]).val()) * $(q[i]).val();
441 $(t[i]).html(addComma(v+''));
442 //$(t[i]).html(v);
443 sub_total += v;
444 }
445 $("#item_total").html(addComma(sub_total+''));
446 var order_usedpoint = $("#order_usedpoint").val()*1;
447 var order_discount = parseFloat($("#order_discount").val());
448 var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
449 var order_cod_fee = parseFloat($("#order_cod_fee").val());
450 var order_tax = parseFloat($("#order_tax").val());
451 total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
452 $("#total_full").html(addComma(total_full+''));
453 $("#total_full_top").html(addComma(total_full+''));
454 <?php do_action( 'order_edit_form_sumPrice',$data); ?>
455 },
456 make_delivery_time : function(selected) {
457 var option = '';
458 if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
459 option += '<option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>' + "\n";
460 }else{
461 for(var i=0; i<delivery_time[selected].length; i++){
462 if( delivery_time[selected][i] == selected_delivery_time ) {
463 option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
464 }else{
465 option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
466 }
467 }
468 }
469 $("#delivery_time_select").html(option);
470
471 },
472 getMember : function( email ) {
473 var s = orderfunc.settings;
474 s.url = uscesL10n.requestFile;
475 s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email);
476 s.success = function(data, dataType){
477 var values = data.split('#usces#');
478 if( 'ok' == values[0]){
479 for(var i=1; i<values.length; i++){
480 var val = values[i].split('=');
481 if( 'member_id' == val[0] ){
482 $("#member_id_label").html(val[1]);
483 $("#member_id").val(val[1]);
484 }else{
485 $(":input[name='" + val[0] + "']").val(val[1]);
486 }
487 }
488 }else if( 'none' == values[0]){
489 alert( '<?php _e("Membership information in question does not exist.", "usces"); ?>' );
490 }else{
491 alert( 'ERROR' );
492 }
493 };
494 s.error = function(data, dataType){
495 alert( 'ERROR' );
496 };
497 $.ajax( s );
498 return false;
499 },
500 recalculation : function() {
501 <?php $script = "
502 var p = $(\"input[name*='skuPrice']\");
503 var q = $(\"input[name*='quant']\");
504 var pi = $(\"input[name*='postId']\");
505 var post_ids = '';
506 var skus = '';
507 var prices = '';
508 var quants = '';
509 for( var i = 0; i < p.length; i++) {
510 post_ids += $(pi[i]).val()+'#usces#';
511 prices += parseFloat($(p[i]).val())+'#usces#';
512 quants += $(q[i]).val()+'#usces#';
513 }
514 var order_usedpoint = $(\"#order_usedpoint\").val()*1;
515 var order_shipping_charge = parseFloat($(\"#order_shipping_charge\").val());
516 var order_cod_fee = parseFloat($(\"#order_cod_fee\").val());
517 var s = orderfunc.settings;
518 s.url = uscesL10n.requestFile;
519 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;
520 s.success = function(data, dataType) {
521 var values = data.split('#usces#');
522 if( 'ok' == values[0] ) {
523 $(\"#order_discount\").val(values[1]);
524 $(\"#order_tax\").val(values[2]);
525 $(\"#order_getpoint\").val(values[3]);
526 $(\"#total_full\").html(addComma(values[4]+''));
527 $(\"#total_full_top\").html(addComma(values[4]+''));
528 } else {
529 alert( 'ERROR1' );
530 }
531 };
532 s.error = function(data, dataType) {
533 alert( 'ERROR2' );
534 };
535 $.ajax( s );
536 return false;
537 ";
538 echo apply_filters( 'order_edit_form_recalculation',$script, $data);
539 ?>
540 },
541 settings: {
542 url: uscesL10n.requestFile,
543 type: 'POST',
544 cache: false,
545 success: function(data, dataType){
546 },
547 error: function(msg){
548 //$("#ajax-response").html(msg);
549 }
550 }
551 };
552
553 uscesMail = {
554 sendmail : function() {
555 if($("#sendmailaddress").val() == "") return;
556
557 var address = encodeURIComponent($("#sendmailaddress").val());
558 var message = encodeURIComponent($("#sendmailmessage").val());
559 var name = encodeURIComponent($("#sendmailname").val());
560 var subject = encodeURIComponent($("#sendmailsubject").val());
561 var order_id = $("#order_id").val();
562 var checked = $("#mailChecked").val();
563
564 var s = uscesMail.settings;
565 s.data = "action=order_item_ajax&mode=sendmail&mailaddress=" + address + "&message=" + message + "&name=" + name + "&subject=" + subject + "&order_id=" + order_id + "&checked=" + checked;
566 s.success = function(data, dataType){
567 if(data == 'success') {
568 if(checked == 'completionmail'){
569 $("input[name='check\[completionmail\]']").attr({checked: true});
570 }else if(checked == 'ordermail'){
571 $("input[name='check\[ordermail\]']").attr({checked: true});
572 }else if(checked == 'changemail'){
573 $("input[name='check\[changemail\]']").attr({checked: true});
574 }else if(checked == 'receiptmail'){
575 $("input[name='check\[receiptmail\]']").attr({checked: true});
576 }else if(checked == 'mitumorimail'){
577 $("input[name='check\[mitumorimail\]']").attr({checked: true});
578 }else if(checked == 'cancelmail'){
579 $("input[name='check\[cancelmail\]']").attr({checked: true});
580 }else if(checked == 'othermail'){
581 $("input[name='check\[othermail\]']").attr({checked: true});
582 }
583 <?php echo apply_filters('usces_filter_order_check_mail_js', '' ); ?>
584
585 $('#mailSendAlert').dialog('option', 'buttons', {
586 'OK': function() {
587 $(this).dialog('close');
588 $('#mailSendDialog').dialog('close');
589 }
590 });
591 $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
592 $('#mailSendAlert fieldset').html('<p><?php _e('E-mail has been sent.', 'usces'); ?></p>');
593 $('#mailSendAlert').dialog('open');
594
595 }else if(data == 'error'){
596 $('#mailSendAlert').dialog('option', 'buttons', {
597 'OK': function() {
598 $(this).dialog('close');
599 }
600 });
601 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
602 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
603 $('#mailSendAlert').dialog('open');
604 }
605 };
606 s.error = function(data, dataType){
607 $('#mailSendAlert').dialog('option', 'buttons', {
608 'OK': function() {
609 $(this).dialog('close');
610 }
611 });
612 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
613 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
614 $('#mailSendAlert').dialog('open');
615 };
616 $.ajax( s );
617 return false;
618 },
619 ordercheckpost : function( checked ) {
620 var p = uscesMail.settings;
621 var order_id = $("#order_id").val();
622 p.url = uscesL10n.requestFile;
623 p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked;
624 p.success = function(data, dataType){
625 if(data == 'mitumoriprint'){
626 $("input[name='check\[mitumoriprint\]']").attr({checked: true});
627 }else if(data == 'nohinprint'){
628 $("input[name='check\[nohinprint\]']").attr({checked: true});
629 }
630 <?php echo apply_filters('usces_filter_order_check_print_js', '' ); ?>
631 };
632 p.error = function(data, dataType){
633 //$("#ajax-response").html(msg);
634 };
635 $.ajax( p );
636 return false;
637 },
638 settings: {
639 url: uscesL10n.requestFile,
640 type: 'POST',
641 cache: false,
642 success: function(data, dataType){
643 },
644 error: function(msg){
645 //$("#ajax-response").html(msg);
646 }
647 }
648 };
649
650 $('form').submit(function() {
651 var error = 0;
652
653 if( !checkNum( $("#order_usedpoint").val() ) ) {
654 error++;
655 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
656 $(this).css({'background-color': '#FFF'});
657 });
658 }
659 if( !checkNum( $("#order_getdpoint").val() ) ) {
660 error++;
661 $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
662 $(this).css({'background-color': '#FFF'});
663 });
664 }
665 if( !checkPrice( $("#order_discount").val() ) ) {
666 error++;
667 $("#order_discount").css({'background-color': '#FFA'}).click(function() {
668 $(this).css({'background-color': '#FFF'});
669 });
670 }
671 if( !checkPrice( $("#order_shipping_charge").val() ) ) {
672 error++;
673 $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
674 $(this).css({'background-color': '#FFF'});
675 });
676 }
677 if( !checkPrice( $("#order_cod_fee").val() ) ) {
678 error++;
679 $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
680 $(this).css({'background-color': '#FFF'});
681 });
682 }
683 if( !checkPrice( $("#order_tax").val() ) ) {
684 error++;
685 $("#order_tax").css({'background-color': '#FFA'}).click(function() {
686 $(this).css({'background-color': '#FFF'});
687 });
688 }
689
690 if( 0 < error ) {
691 $("#aniboxStatus").removeClass("none");
692 $("#aniboxStatus").addClass("error");
693 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
694 $("#info_massage").html("データに不備があります");
695 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
696 return false;
697 } else {
698 return true;
699 }
700 });
701 <?php do_action('usces_action_order_edit_page_js', $order_id, $data ); ?>
702 <?php echo apply_filters('usces_filter_order_edit_page_js', '', $order_id ); ?>
703 });
704
705 function toggleVisibility(id) {
706 var e = document.getElementById(id);
707 if(e.style.display == 'block') {
708 e.style.display = 'none';
709 //document.getElementById("searchSwitchStatus").value = 'OFF';
710 } else {
711 e.style.display = 'block';
712 //document.getElementById("searchSwitchStatus").value = 'ON';
713 //document.getElementById("searchVisiLink").style.display = 'none';
714 }
715 };
716
717 function addComma(str)
718 {
719 var strs = str.split('.');
720 cnt = 0;
721 n = "";
722 //20120606ysk start 0000497
723 m = "";
724 if( strs[0].substr(0, 1) == "-" ) {
725 m = "-";
726 strs[0] = strs[0].substr(1);
727 }
728 //20120606ysk end
729 for (i=strs[0].length-1; i>=0; i--)
730 {
731 n = strs[0].charAt(i) + n;
732 cnt++;
733 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
734 }
735 n = m + n;//20120606ysk 0000497
736 if(undefined != strs[1]){
737 res = n + '.' + strs[1];
738 }else{
739 res = n;
740 }
741 return res;
742 };
743
744 function pdfWindow( type ) {
745 var wx = 800;
746 var wy = 900;
747 var x = (screen.width- wx) / 2;
748 var y = (screen.height - wy) / 2;
749 x = 0;
750 y = 0;
751 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");
752 }
753 //20120606ysk start 0000497
754 function checkNumMinus( argValue ) {
755 if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
756 return false;
757 }
758 return true;
759 }
760 //20120606ysk end
761 //20120307ysk start 0000432
762 function delConfirm(){
763 if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
764 return true;
765 }else{
766 return false;
767 }
768 }
769 //20120307ysk end
770
771 jQuery(document).ready(function($){
772 //20120528ysk start 0000485
773 // var p = $("input[name*='skuPrice']");
774 // var q = $("input[name*='quant']");
775 // var t = $("td[id*='sub_total']");
776 // var db = $("input[name*='delButton']");
777
778 orderfunc.sumPrice(null);
779
780 // for( var i = 0; i < p.length; i++) {
781 // $(p[i]).live("change", function(){ orderfunc.sumPrice($(p[i])); });
782 // $(q[i]).live("change", function(){ orderfunc.sumPrice($(q[i])); });
783 // $(db[i]).live("click", function(){ return delConfirm($(db[i])); });
784 // }
785 $("input[name*='skuPrice']").live("change", function(){ orderfunc.sumPrice($(this)); });
786 $("input[name*='quant']").live("change", function(){ orderfunc.sumPrice($(this)); });
787 $("input[name*='delButton']").live("click", function(){ orderfunc.sumPrice(null); });
788 //20120528ysk end
789 $("#order_usedpoint").live("change", function(){ orderfunc.sumPrice($("#order_usedpoint")); });
790 $("#order_discount").live("change", function(){ orderfunc.sumPrice($("#order_discount")); });
791 $("#order_shipping_charge").live("change", function(){ orderfunc.sumPrice($("#order_shipping_charge")); });
792 $("#order_cod_fee").live("change", function(){ orderfunc.sumPrice($("#order_cod_fee")); });
793 $("#order_tax").live("change", function(){ orderfunc.sumPrice($("#order_tax")); });
794 $("input[name*='upButton']").click(function(){
795 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() ){
796 if( confirm("<?php _e("Are you sure you want to change to today's date Date of renovation?", "usces"); ?>\n<?php _e("Please press the cancel If you want to update without changing the modified date.", "usces"); ?>") ){
797 $('#up_modified').val('update');
798 }else{
799 $('#up_modified').val('');
800 }
801 }
802 return true;
803 });
804
805 //20120307ysk start 0000432
806 //function delConfirm(){
807 // if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
808 // return true;
809 // }else{
810 // return false;
811 // }
812 //}
813 //20120307ysk end
814
815 orderfunc.make_delivery_time(<?php echo $order_delivery_method; ?>);
816
817 $("#get_member").click(function(){
818 if( '' == $("input[name='customer[mailaddress]']").val() ){
819 alert('e-mail を�
820 �力して下さい。');
821 return;
822 }
823 if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
824 //20120914ysk start 0000567
825 //if( confirm('<?php _e("I will overwrite customer information, and shipping information. Would you like?", "usces"); ?>') ){
826 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") ){
827 //orderfunc.getMember($("input[name='customer[mailaddress]']").val());
828 return;
829 }
830 }
831 orderfunc.getMember($("input[name='customer[mailaddress]']").val());
832 //20120914ysk end
833 });
834 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
835 $("#costomercopy").click(function() {
836 if( '' != $("input[name='delivery[name1]']").val() ||
837 '' != $("input[name='delivery[name2]']").val() ||
838 '' != $("input[name='delivery[name3]']").val() ||
839 '' != $("input[name='delivery[name4]']").val() ||
840 '' != $("input[name='delivery[zipcode]']").val() ||
841 '' != $("input[name='delivery[address1]']").val() ||
842 '' != $("input[name='delivery[address2]']").val() ||
843 '' != $("input[name='delivery[address3]']").val() ||
844 '' != $("input[name='delivery[tel]']").val() ||
845 '' != $("input[name='delivery[fax]']").val() ) {
846 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") )
847 return;
848 }
849 $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
850 $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
851 $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
852 $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
853 $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
854 $("#delivery_country").val($("#customer_country option:selected").val());
855 $("#delivery_pref").val($("#customer_pref option:selected").val());
856 $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
857 $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
858 $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
859 $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
860 $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
861 });
862 <?php endif;//20120319ysk end ?>
863
864 $("#recalc").click(function(){ orderfunc.recalculation(); });
865 });
866 </script>
867 <div class="wrap">
868 <div class="usces_admin">
869 <form action="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action='.$oa; ?>" method="post" name="editpost">
870
871 <h2>Welcart Management <?php _e('Edit order data','usces'); ?></h2>
872 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
873 <div id="aniboxStatus" class="<?php echo $status; ?>">
874 <div id="anibox" class="clearfix">
875 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
876 <div class="mes" id="info_massage"><?php echo $message; ?></div>
877 </div>
878 </div>
879 <div class="mailVisiLink">
880 <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>
881 </div>
882 <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>
883 <div id="mailBox">
884 <table>
885 <tr>
886 <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>
887 <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>
888 <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>
889 <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>
890 <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>
891 <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>
892 </tr>
893 <tr>
894 <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>
895 <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>
896 <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>
897 <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>
898 <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>
899 <?php echo apply_filters('usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
900 </tr>
901 <tr>
902 <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>
903 </tr>
904 </table>
905 </div>
906 <div class="info_head">
907 <table>
908 <tr>
909 <td colspan="6" class="midasi0"><?php _e('order details', 'usces'); ?></td>
910 </tr>
911 <tr>
912 <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>
913 <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>
914 <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>
915 </tr>
916 <tr>
917 <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 }else{ ?><input name="member_id" id="member_id" type="hidden" value="<?php esc_attr_e(isset($data['mem_id']) ? $data['mem_id'] : ''); ?>" /><?php } ?></td>
918 <td colspan="2" rowspan="10" class="wrap_td">
919 <table border="0" cellspacing="0" class="cus_info">
920 <tr>
921 <td class="label">e-mail</td>
922 <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="<?php _e('Membership information acquisition', 'usces'); ?>" /></td>
923 </tr>
924
925 <?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
926
927 </table></td>
928 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
929 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?><input type="button" id="costomercopy" value="<?php _e("Same shipping address", "usces"); ?>"></td>
930 <?php else : ?>
931 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?></td>
932 <?php endif;//20120319ysk end ?>
933 </tr>
934 <tr>
935 <td class="label"><?php _e('payment method', 'usces'); ?></td>
936 <td class="col1"><select name="offer[payment_name]" id="order_payment_name">
937 <option value="#none#"><?php _e('-- Select --', 'usces'); ?></option>
938 <?php
939 if( $payment_method ) {
940 foreach ((array)$payment_method as $payments) {
941 if( $payments['name'] != '' ) {
942 $selected = (isset($data['order_payment_name']) && $payments['name'] == $data['order_payment_name']) ? ' selected="selected"' : '';
943 ?>
944 <option value="<?php echo esc_attr($payments['name']); ?>"<?php echo $selected; ?>><?php echo esc_attr($payments['name']); ?></option>
945 <?php } } } ?>
946 </select></td>
947 <td colspan="2" rowspan="9" class="wrap_td">
948 <table border="0" cellspacing="0" class="deli_info">
949
950 <?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
951
952 </table></td>
953 </tr>
954 <tr>
955 <td class="label"><?php _e('shipping option','usces'); ?></td>
956 <td class="col1"><select name="offer[delivery_method]" id="delivery_method_select">
957 <option value="-1"><?php _e('Non-request', 'usces'); ?></option>
958 <?php
959 foreach ((array)$this->options['delivery_method'] as $dkey => $delivery) {
960 $selected = $order_delivery_method == $delivery['id'] ? ' selected="selected"' : '';
961 echo "\t<option value='" . esc_attr($delivery['id']) . "'{$selected}>" . esc_attr($delivery['name']) . "</option>\n";
962 }
963 ?>
964 </select></td>
965 <?php //if( USCES_JP ): ?>
966 </tr>
967 <?php //endif; ?>
968 <!--20101208ysk start-->
969 <tr>
970 <td class="label"><?php _e('Delivery date', 'usces'); ?></td>
971 <td class="col1"><select name="offer[delivery_date]" id="delivery_date_select">
972 <?php
973 $delivery_days_select = '<option value="'.__('Non-request', 'usces').'">'.__('Non-request', 'usces').'</option>';
974 $data_order_date = explode(" ", $data['order_date']);
975 $order_date = explode("-", $data_order_date[0]);
976 //for($i = 0; $i < 50; $i++) {
977 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
978 $value = date('Y-m-d', mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
979 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
980 $selected = (isset($data['order_delivery_date']) && $data['order_delivery_date'] == $value) ? ' selected="selected"' : '';
981 $delivery_days_select .= '<option value="'.$value.'"'.$selected.'>'.$date.'</option>';
982 }
983 ?>
984 <?php echo apply_filters( 'usces_filter_order_edit_delivery_days_select', $delivery_days_select, $data, $delivery_after_days ); ?>
985 </select></td>
986 </tr>
987 <!--20101208ysk end-->
988 <tr>
989 <td class="label"><?php _e('delivery time', 'usces'); ?></td>
990 <td class="col1">
991 <select name="offer[delivery_time]" id="delivery_time_select">
992 <option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>
993 </select>
994 </td>
995 </tr>
996 <tr>
997 <td class="label"><?php _e('Shipping date', 'usces'); ?></td>
998 <td class="col1"><select name="offer[delidue_date]">
999 <option value="#none#"><?php _e('Not notified', 'usces'); ?></option>
1000 <?php
1001 //for ($i=0; $i<50; $i++) {
1002 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
1003 $value = date('Y-m-d', mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
1004 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
1005 $selected = (isset($data['order_delidue_date']) && $data['order_delidue_date'] == $value) ? ' selected="selected"' : '';
1006 echo "\t<option value='{$value}'{$selected}>{$date}</option>\n";
1007 }
1008 ?>
1009 </select></td>
1010 </tr>
1011 <tr>
1012 <td colspan="2" class="midasi3"><?php _e('Status', 'usces'); ?></td>
1013 </tr>
1014 <tr>
1015 <td class="label status"><?php _e('The correspondence situation', 'usces'); ?></td>
1016 <td class="col1 status">
1017 <select name="offer[taio]" id="order_taio">
1018 <option value='#none#'><?php _e('new order', 'usces'); ?></option>
1019 <?php
1020 foreach ($management_status as $status_key => $status_name){
1021 if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
1022 continue;
1023 ?>
1024 <option value="<?php echo $status_key; ?>"<?php if($taio == $status_key){ echo ' selected="selected"';} ?>><?php echo $status_name; ?></option>
1025 <?php
1026 }
1027 ?>
1028 </select></td>
1029 </tr>
1030 <tr>
1031 <td class="label status" id="receiptlabel"><?php if($receipt != ''){echo __('transfer statement', 'usces');}else{echo '&nbsp';} ?></td>
1032 <td class="col1 status" id="receiptbox">
1033 <?php if($receipt != '') : ?>
1034 <select name="offer[receipt]">
1035 <option value='noreceipt'<?php if($receipt == 'noreceipt'){ echo ' selected="selected"';} ?>><?php echo $management_status['noreceipt']; ?></option>
1036 <option value='receipted'<?php if($receipt == 'receipted'){ echo ' selected="selected"';} ?>><?php echo $management_status['receipted']; ?></option>
1037 <option value='pending'<?php if($receipt == 'pending'){ echo ' selected="selected"';} ?>><?php echo $management_status['pending']; ?></option>
1038 </select>
1039 <?php else : ?>
1040 &nbsp
1041 <?php endif; ?>
1042 </td>
1043 </tr>
1044 <tr>
1045 <td class="label status"><?php if($admin != ''){echo __('estimate order', 'usces');}else{echo '&nbsp';} ?></td>
1046 <td class="col1 status">
1047 <?php if($admin != '') : ?>
1048 <select name="offer[admin]">
1049 <option value='adminorder'<?php if($admin == 'adminorder'){ echo 'selected="selected"';} ?>><?php echo $management_status['adminorder']; ?></option>
1050 <option value='estimate'<?php if($admin == 'estimate'){ echo 'selected="selected"';} ?>><?php echo $management_status['estimate']; ?></option>
1051 </select>
1052 <?php else : ?>
1053 &nbsp
1054 <?php endif; ?></td>
1055 </tr>
1056 <tr>
1057 <td colspan="2" class="status">
1058 <div class="midasi2"><?php if($condition['display_mode'] == 'Usualsale'){echo __('normal sale', 'usces');}elseif($condition['display_mode'] == 'Promotionsale'){echo __('Sale Campaign', 'usces');} ?></div>
1059 <div class="condition">
1060 <?php if ( $condition['display_mode'] == 'Promotionsale' ) : ?>
1061 <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 />
1062 <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 />
1063 <?php endif; ?>
1064 </div></td>
1065 <td class="label"><?php _e('Notes', 'usces'); ?></td>
1066 <td colspan="3"><textarea name="offer[note]"><?php echo esc_attr(isset($data['order_note']) ? $data['order_note'] : ''); ?></textarea></td>
1067 </tr>
1068 </table>
1069 </div>
1070 <?php //if( $this->has_order_custom_info( $order_id ) ): ?>
1071 <div class="info_head">
1072 <table>
1073 <tr>
1074 <td class="midasi0"><?php _e('Custom order field', 'usces'); ?></td>
1075 <td class="midasi0"><?php _e('Payment information', 'usces'); ?></td>
1076 </tr>
1077 <tr>
1078 <td class="wrap_td">
1079 <table class="order_custom_wrap">
1080 <tr>
1081 <?php do_action( 'usces_action_order_edit_form_custom', $data, $csod_meta ); ?>
1082 <?php
1083 //20100818ysk start
1084 usces_admin_custom_field_input($csod_meta, 'order', '');
1085 //20100818ysk end
1086 ?>
1087 </tr>
1088
1089 </table>
1090 </td>
1091 <td class="wrap_td">
1092 <table class="settle_info_wrap">
1093 <?php usces_settle_info_field( $order_id, 'tr' ); ?>
1094 </table>
1095 </td>
1096 </tr>
1097 </table>
1098 </div>
1099 <?php //endif; ?>
1100 <div id="cart">
1101 <?php
1102 ob_start();
1103 ?>
1104 <table cellspacing="0" id="cart_table">
1105 <thead>
1106 <tr>
1107 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1108 <th id="total_full_top" class="aright">&nbsp;</th>
1109 <th colspan="2">&nbsp;<?php _e('Currency','usces'); ?>(<?php usces_crcode(); ?>)</th>
1110 </tr>
1111 <tr>
1112 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
1113 <th class="thumbnail"> <?php //echo __('thumbnail','usces'); ?></th>
1114 <th><?php _e('Items','usces'); ?></th>
1115 <th class="price"><?php _e('Unit price','usces'); ?></th>
1116 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
1117 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
1118 <th class="stock"><?php _e('Current stock', 'usces'); ?></th>
1119 <th class="action"><input name="addButton" id="addCartButton" class="addCartButton" type="button" value="<?php _e('Add item', 'usces'); ?>" /></th>
1120 </tr>
1121 </thead>
1122 <tbody id="orderitemlist">
1123 <?php echo usces_get_ordercart_row( $order_id, $cart ); ?>
1124 </tbody>
1125 <tfoot>
1126 <tr>
1127 <th colspan="5" class="aright"><?php _e('total items','usces'); ?></th>
1128 <th id="item_total" class="aright">&nbsp;</th>
1129 <th colspan="2">&nbsp;</th>
1130 </tr>
1131 <tr>
1132 <td colspan="5" class="aright"><?php echo apply_filters('usces_confirm_discount_label', __('Campaign disnount', 'usces'), $order_id); ?></td>
1133 <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>
1134 <td colspan="2"><?php _e('Discounted amount should be shown by -(Minus)', 'usces'); ?>&nbsp;</td>
1135 </tr>
1136 <tr>
1137 <td colspan="5" class="aright"><?php usces_tax_label($data); ?></td>
1138 <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>
1139 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1140 </tr>
1141 <tr>
1142 <td colspan="5" class="aright"><?php _e('Shipping', 'usces'); ?></td>
1143 <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>
1144 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1145 </tr>
1146 <tr>
1147 <td colspan="5" class="aright"><?php echo apply_filters('usces_filter_cod_label', __('COD fee', 'usces')); ?></td>
1148 <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>
1149 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1150 </tr>
1151 <tr>
1152 <td colspan="5" class="aright"><?php _e('Used points','usces'); ?></td>
1153 <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>
1154 <td><?php _e('granted points', 'usces'); ?></td>
1155 <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>
1156 </tr>
1157 <tr>
1158 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1159 <th id="total_full" class="aright">&nbsp;</th>
1160 <th colspan="2"><input name="recalc" id="recalc" class="addCartButton" type="button" value="<?php _e('Recalculation', 'usces'); ?>" /></th>
1161 </tr>
1162 </tfoot>
1163 </table>
1164 <?php
1165 $cart_table = ob_get_contents();
1166 ob_end_clean();
1167 echo apply_filters( 'usces_filter_ordereditform_carttable', $cart_table, $filter_args );
1168 ?>
1169 </div>
1170 <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>
1171
1172 <input name="order_action" type="hidden" value="<?php echo $oa; ?>" />
1173 <input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr(isset($data['ID']) ? $data['ID'] : ''); ?>" />
1174 <input name="old_getpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_getpoint']) ? $data['order_getpoint'] : ''); ?>" />
1175 <input name="old_usedpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_usedpoint']) ? $data['order_usedpoint'] : ''); ?>" />
1176 <input name="up_modified" id="up_modified" type="hidden" value="" />
1177 <input name="modified" id="modified" type="hidden" value="<?php echo esc_attr(isset($data['order_modified']) ? $data['order_modified'] : ''); ?>" />
1178
1179
1180
1181
1182 <div id="addItemDialog" title="<?php _e('Add item', 'usces'); ?>">
1183 <div id="order-response"></div>
1184 <fieldset>
1185 <div class="clearfix">
1186 <div class="dialogsearch">
1187 <label>商品カテゴリー </label>
1188 <?php
1189 $idObj = get_category_by_slug('item');
1190 $dropdown_options = array( 'show_option_none' => 'カテゴリーを選択して下さい', 'name' => 'newitemcategory', 'id' => 'newitemcategory', 'hide_empty' => 1, 'hierarchical' => 1, 'orderby' => 'name', 'child_of' => $idObj->term_id);
1191 wp_dropdown_categories($dropdown_options);
1192 ?>
1193 <br />
1194 <label>追加する商品 </label><select name="newitemcode" id="newitemcode"></select><br />
1195 <div id="loading"></div>
1196 <label for="name"><?php _e('item code', 'usces'); ?></label>
1197 <input type="text" name="newitemcode" id="newitemcode" class="text" />
1198 <input name="getitem" type="button" value="<?php _e('Obtain', 'usces'); ?>" onclick="if( jQuery('#newitemcode').val() == '' ) return; orderItem.getitem();" />
1199 </div>
1200 <div id="newitemform"></div>
1201 </div>
1202 </fieldset>
1203 </div>
1204
1205
1206
1207 <div id="mailSendDialog" title="">
1208 <div id="order-response"></div>
1209 <fieldset>
1210 <p><?php _e("Check the mail and click 'send'", 'usces'); ?></p>
1211 <label><?php _e('e-mail adress', 'usces'); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
1212 <label><?php _e('Client name', 'usces'); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
1213 <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 />
1214 <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
1215 <input name="mailChecked" id="mailChecked" type="hidden" />
1216 </fieldset>
1217 </div>
1218
1219 <div id="mailSendAlert" title="">
1220 <div id="order-response"></div>
1221 <fieldset>
1222 </fieldset>
1223 </div>
1224 <input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
1225 </form>
1226
1227 <div id="PDFDialog" title="">
1228 <div id="pdf_response"></div>
1229 <fieldset>
1230 <div id="new_pdf"></div>
1231 </fieldset>
1232 </div>
1233 <?php do_action( 'usces_action_endof_order_edit_form', $data ); ?>
1234 </div><!--usces_admin-->
1235 </div><!--wrap-->
1236