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

1,246 lines 53.3 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 $noreceipt_status = get_option( 'usces_noreceipt_status' );
203 ?>
204 <script type="text/javascript">
205 jQuery(function($){
206 <?php if($status == 'success'){ ?>
207 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
208 <?php }else if($status == 'caution'){ ?>
209 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
210 <?php }else if($status == 'error'){ ?>
211 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
212 <?php } ?>
213 var selected_delivery_time = '<?php esc_html_e(isset($data['order_delivery_time']) ? $data['order_delivery_time'] : ''); ?>';
214 var delivery_time = [];
215 <?php
216 foreach((array)$this->options['delivery_method'] as $dmid => $dm){
217 $lines = explode("\n", $dm['time']);
218 ?>
219 delivery_time[<?php echo $dm['id']; ?>] = [];
220 <?php
221 foreach((array)$lines as $line){
222 if(trim($line) != ''){
223 ?>
224 delivery_time[<?php echo $dm['id']; ?>].push("<?php echo trim($line); ?>");
225 <?php }
226 }
227 }
228 ?>
229
230 $("#order_payment_name").change(function () {
231 var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
232 var noreceipt_status = [ '<?php echo implode( "','", $noreceipt_status ); ?>' ];
233 if( $.inArray( uscesPayments[pay_name], noreceipt_status ) >= 0 ) {
234 var label = '<?php _e('transfer statement', 'usces'); ?>';
235 var html = "<select name='offer[receipt]'>\n";
236 html += "<option value='noreceipt'><?php echo $management_status['noreceipt']; ?></option>\n";
237 html += "<option value='receipted'><?php echo $management_status['receipted']; ?></option>\n";
238 html += "</select>\n";
239 $("#receiptlabel").html(label);
240 $("#receiptbox").html(html);
241 <?php do_action( 'usces_change_payment_terms_js', $management_status, $data ); ?>
242 }else{
243 $("#receiptlabel").html('');
244 $("#receiptbox").html('');
245 }
246 });
247
248 $("#addItemDialog").dialog({
249 bgiframe: true,
250 autoOpen: false,
251 height: 500,
252 width: 700,
253 resizable: true,
254 modal: true,
255 appendTo: "#dialog_parent",
256 buttons: {
257 '<?php _e('close', 'usces'); ?>': function() {
258 $(this).dialog('close');
259 }
260 },
261 close: function() {
262 $("#newitemcategory").val( "-1" );
263 $("#newitemform").html( "" );
264 $('#newitemcode').val('');
265 }
266 });
267 $('#addCartButton').click(function() {
268 if($("input[name='order_id']").val() == ''){
269 alert("<?php _e("Push 'change decision' button, to be settled with an order number.", 'usces'); ?>");
270 return;
271 }
272 $('#addItemDialog').dialog('open');
273 });
274 $('#delivery_method_select').change(function() {
275 orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
276 });
277
278 $("#mailSendDialog").dialog({
279 bgiframe: true,
280 autoOpen: false,
281 height: 650,
282 width: 700,
283 resizable: true,
284 modal: true,
285 buttons: {
286 '<?php _e('close', 'usces'); ?>': function() {
287 $(this).dialog('close');
288 }
289 },
290 appendTo:"#dialog_parent",
291 close: function() {
292 $("#sendmailmessage").html( "" );
293 $('#sendmailaddress').val('');
294 }
295 });
296 $('#completionMail').click(function() {
297 orderItem.getmailmessage('completionMail');
298 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
299 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
300 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['completionmail'], $data, 'completionMail')); ?>');
301 $('#mailChecked').val('completionmail');
302 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for Shipping', 'usces'); ?>');
303 $('#mailSendDialog').dialog('open');
304 });
305 $('#orderConfirmMail').click(function() {
306 orderItem.getmailmessage('orderConfirmMail');
307 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
308 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
309 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['ordermail'], $data, 'orderConfirmMail')); ?>');
310 $('#mailChecked').val('ordermail');
311 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of order', 'usces'); ?>');
312 $('#mailSendDialog').dialog('open');
313 });
314 $('#changeConfirmMail').click(function() {
315 orderItem.getmailmessage('changeConfirmMail');
316 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
317 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
318 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['changemail'], $data, 'changeConfirmMail')); ?>');
319 $('#mailChecked').val('changemail');
320 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confiemation of change', 'usces'); ?>');
321 $('#mailSendDialog').dialog('open');
322 });
323 $('#receiptConfirmMail').click(function() {
324 orderItem.getmailmessage('receiptConfirmMail');
325 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
326 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
327 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['receiptmail'], $data, 'receiptConfirmMail')); ?>');
328 $('#mailChecked').val('receiptmail');
329 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of transter', 'usces'); ?>');
330 $('#mailSendDialog').dialog('open');
331 });
332 $('#mitumoriConfirmMail').click(function() {
333 orderItem.getmailmessage('mitumoriConfirmMail');
334 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
335 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
336 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['mitumorimail'], $data, 'mitumoriConfirmMail')); ?>');
337 $('#mailChecked').val('mitumorimail');
338 $('#mailSendDialog').dialog('option', 'title', '<?php _e('estimate mail', 'usces'); ?>');
339 $('#mailSendDialog').dialog('open');
340 });
341 $('#cancelConfirmMail').click(function() {
342 orderItem.getmailmessage('cancelConfirmMail');
343 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
344 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
345 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['cancelmail'], $data, 'cancelConfirmMail')); ?>');
346 $('#mailChecked').val('cancelmail');
347 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Cancelling mail', 'usces'); ?>');
348 $('#mailSendDialog').dialog('open');
349 });
350 $('#otherConfirmMail').click(function() {
351 orderItem.getmailmessage('otherConfirmMail');
352 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
353 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
354 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['othermail'], $data, 'otherConfirmMail')); ?>');
355 $('#mailChecked').val('othermail');
356 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Other mail', 'usces'); ?>');
357 $('#mailSendDialog').dialog('open');
358 });
359
360 $("#mailSendAlert").dialog({
361 bgiframe: true,
362 autoOpen: false,
363 height: 200,
364 width: 200,
365 resizable: false,
366 modal: false
367 });
368 $("#sendmail").click(function() {
369 uscesMail.sendmail();
370 });
371
372 $("#PDFDialog").dialog({
373 bgiframe: true,
374 autoOpen: false,
375 height: 800,
376 width: 700,
377 resizable: true,
378 modal: true,
379 buttons: {
380 '<?php _e('close', 'usces'); ?>': function() {
381 $(this).dialog('close');
382 }
383 },
384 close: function() {
385 $("#new_pdf").html( "" );
386 }
387 });
388 $('#mitumoriprint').click(function() {
389 $('#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>');
390 $('#PDFDialog').dialog('option', 'title', '<?php _e('print out the estimate', 'usces'); ?>');
391 $('#PDFDialog').dialog('open');
392 uscesMail.ordercheckpost('mitumoriprint');
393 });
394 $('#nohinprint').click(function() {
395 $('#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>');
396 $('#PDFDialog').dialog('option', 'title', '<?php _e('print out Delivery Statement', 'usces'); ?>');
397 $('#PDFDialog').dialog('open');
398 uscesMail.ordercheckpost('nohinprint');
399 });
400 $('#receiptprint').click(function() {
401 $('#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>');
402 $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Receipt', 'usces'); ?>');
403 $('#PDFDialog').dialog('open');
404 uscesMail.ordercheckpost('receiptprint');
405 });
406 $('#billprint').click(function() {
407 $('#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>');
408 $('#PDFDialog').dialog('option', 'title', '<?php _e('Print Invoice', 'usces'); ?>');
409 $('#PDFDialog').dialog('open');
410 uscesMail.ordercheckpost('billprint');
411 });
412
413 orderfunc = {
414 sumPrice : function(obj) {
415 if(obj != null) {
416 //20120606ysk start 0000497
417 //if(!checkNum(obj.val())) {
418 if(!checkNumMinus(obj.val())) {
419 //20120606ysk end
420 alert('<?php _e("Please enter a numeric value.", "usces"); ?>');
421 obj.focus();
422 return false;
423 }
424 }
425
426 var p = $("input[name*='skuPrice']");
427 var q = $("input[name*='quant']");
428 var t = $("td[id*='sub_total']");
429 var db = $("input[name*='delButton']");
430 var price = [];
431 var quant = [];
432 var sub_total = <?php echo apply_filters('order_edit_form_sub_total', 0, $data); ?>;
433 var total_full = 0;
434 for( var i = 0; i < p.length; i++) {
435 v = parseFloat($(p[i]).val()) * $(q[i]).val();
436 $(t[i]).html(addComma(v+''));
437 //$(t[i]).html(v);
438 sub_total += v;
439 }
440 $("#item_total").html(addComma(sub_total+''));
441 var order_usedpoint = $("#order_usedpoint").val()*1;
442 var order_discount = parseFloat($("#order_discount").val());
443 var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
444 var order_cod_fee = parseFloat($("#order_cod_fee").val());
445 var order_tax = parseFloat($("#order_tax").val());
446 total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
447 $("#total_full").html(addComma(total_full+''));
448 $("#total_full_top").html(addComma(total_full+''));
449 <?php do_action( 'order_edit_form_sumPrice',$data); ?>
450 },
451 make_delivery_time : function(selected) {
452 var option = '';
453 if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
454 option += '<option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>' + "\n";
455 }else{
456 for(var i=0; i<delivery_time[selected].length; i++){
457 if( delivery_time[selected][i] == selected_delivery_time ) {
458 option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
459 }else{
460 option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
461 }
462 }
463 }
464 $("#delivery_time_select").html(option);
465
466 },
467 getMember : function( email ) {
468 var s = orderfunc.settings;
469 s.url = uscesL10n.requestFile;
470 s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email);
471 s.success = function(data, dataType){
472 var values = data.split('#usces#');
473 if( 'ok' == values[0]){
474 for(var i=1; i<values.length; i++){
475 var val = values[i].split('=');
476 if( 'member_id' == val[0] ){
477 $("#member_id_label").html(val[1]);
478 $("#member_id").val(val[1]);
479 }else{
480 $(":input[name='" + val[0] + "']").val(val[1]);
481 }
482 }
483 }else if( 'none' == values[0]){
484 alert( '<?php _e("Membership information in question does not exist.", "usces"); ?>' );
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 pi = $(\"input[name*='postId']\");
500 var post_ids = '';
501 var skus = '';
502 var prices = '';
503 var quants = '';
504 for( var i = 0; i < p.length; i++) {
505 post_ids += $(pi[i]).val()+'#usces#';
506 prices += parseFloat($(p[i]).val())+'#usces#';
507 quants += $(q[i]).val()+'#usces#';
508 }
509 var order_usedpoint = $(\"#order_usedpoint\").val()*1;
510 var order_shipping_charge = parseFloat($(\"#order_shipping_charge\").val());
511 var order_cod_fee = parseFloat($(\"#order_cod_fee\").val());
512 var s = orderfunc.settings;
513 s.url = uscesL10n.requestFile;
514 s.data = 'action=order_item_ajax&mode=recalculation&order_id='+$('#order_id').val()+'&mem_id='+$('#member_id_label').html()+'&post_ids='+post_ids+'&skus='+skus+'&prices='+prices+'&quants='+quants+'&upoint='+order_usedpoint+'&shipping_charge='+order_shipping_charge+'&cod_fee='+order_cod_fee;
515 s.success = function(data, dataType) {
516 var values = data.split('#usces#');
517 if( 'ok' == values[0] ) {
518 $(\"#order_discount\").val(values[1]);
519 $(\"#order_tax\").val(values[2]);
520 $(\"#order_getpoint\").val(values[3]);
521 $(\"#total_full\").html(addComma(values[4]+''));
522 $(\"#total_full_top\").html(addComma(values[4]+''));
523 } else {
524 alert( 'ERROR1' );
525 }
526 };
527 s.error = function(data, dataType) {
528 alert( 'ERROR2' );
529 };
530 $.ajax( s );
531 return false;";
532 echo apply_filters( 'order_edit_form_recalculation',$script, $data);
533 ?>
534 },
535 settings: {
536 url: uscesL10n.requestFile,
537 type: 'POST',
538 cache: false,
539 success: function(data, dataType){
540 },
541 error: function(msg){
542 //$("#ajax-response").html(msg);
543 }
544 }
545 };
546
547 uscesMail = {
548 sendmail : function() {
549 if($("#sendmailaddress").val() == "") return;
550
551 var address = encodeURIComponent($("#sendmailaddress").val());
552 var message = encodeURIComponent($("#sendmailmessage").val());
553 var name = encodeURIComponent($("#sendmailname").val());
554 var subject = encodeURIComponent($("#sendmailsubject").val());
555 var order_id = $("#order_id").val();
556 var checked = $("#mailChecked").val();
557
558 var s = uscesMail.settings;
559 s.data = "action=order_item_ajax&mode=sendmail&mailaddress=" + address + "&message=" + message + "&name=" + name + "&subject=" + subject + "&order_id=" + order_id + "&checked=" + checked;
560 s.success = function(data, dataType){
561 if(data == 'success') {
562 if(checked == 'completionmail'){
563 $("input[name='check\[completionmail\]']").attr({checked: true});
564 }else if(checked == 'ordermail'){
565 $("input[name='check\[ordermail\]']").attr({checked: true});
566 }else if(checked == 'changemail'){
567 $("input[name='check\[changemail\]']").attr({checked: true});
568 }else if(checked == 'receiptmail'){
569 $("input[name='check\[receiptmail\]']").attr({checked: true});
570 }else if(checked == 'mitumorimail'){
571 $("input[name='check\[mitumorimail\]']").attr({checked: true});
572 }else if(checked == 'cancelmail'){
573 $("input[name='check\[cancelmail\]']").attr({checked: true});
574 }else if(checked == 'othermail'){
575 $("input[name='check\[othermail\]']").attr({checked: true});
576 }
577 <?php echo apply_filters('usces_filter_order_check_mail_js', '' ); ?>
578
579 $('#mailSendAlert').dialog('option', 'buttons', {
580 'OK': function() {
581 $(this).dialog('close');
582 $('#mailSendDialog').dialog('close');
583 }
584 });
585 $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
586 $('#mailSendAlert fieldset').html('<p><?php _e('E-mail has been sent.', 'usces'); ?></p>');
587 $('#mailSendAlert').dialog('open');
588
589 }else if(data == 'error'){
590 $('#mailSendAlert').dialog('option', 'buttons', {
591 'OK': function() {
592 $(this).dialog('close');
593 }
594 });
595 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
596 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
597 $('#mailSendAlert').dialog('open');
598 }
599 };
600 s.error = function(data, dataType){
601 $('#mailSendAlert').dialog('option', 'buttons', {
602 'OK': function() {
603 $(this).dialog('close');
604 }
605 });
606 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
607 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
608 $('#mailSendAlert').dialog('open');
609 };
610 $.ajax( s );
611 return false;
612 },
613 ordercheckpost : function( checked ) {
614 var p = uscesMail.settings;
615 var order_id = $("#order_id").val();
616 p.url = uscesL10n.requestFile;
617 p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked;
618 p.success = function(data, dataType){
619 if(data == 'mitumoriprint'){
620 $("input[name='check\[mitumoriprint\]']").attr({checked: true});
621 }else if(data == 'nohinprint'){
622 $("input[name='check\[nohinprint\]']").attr({checked: true});
623 }
624 <?php echo apply_filters('usces_filter_order_check_print_js', '' ); ?>
625 };
626 p.error = function(data, dataType){
627 //$("#ajax-response").html(msg);
628 };
629 $.ajax( p );
630 return false;
631 },
632 settings: {
633 url: uscesL10n.requestFile,
634 type: 'POST',
635 cache: false,
636 success: function(data, dataType){
637 },
638 error: function(msg){
639 //$("#ajax-response").html(msg);
640 }
641 }
642 };
643
644 $('form').submit(function() {
645 var error = 0;
646
647 if( !checkNum( $("#order_usedpoint").val() ) ) {
648 error++;
649 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
650 $(this).css({'background-color': '#FFF'});
651 });
652 }
653 if( !checkNum( $("#order_getdpoint").val() ) ) {
654 error++;
655 $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
656 $(this).css({'background-color': '#FFF'});
657 });
658 }
659 if( !checkPrice( $("#order_discount").val() ) ) {
660 error++;
661 $("#order_discount").css({'background-color': '#FFA'}).click(function() {
662 $(this).css({'background-color': '#FFF'});
663 });
664 }
665 if( !checkPrice( $("#order_shipping_charge").val() ) ) {
666 error++;
667 $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
668 $(this).css({'background-color': '#FFF'});
669 });
670 }
671 if( !checkPrice( $("#order_cod_fee").val() ) ) {
672 error++;
673 $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
674 $(this).css({'background-color': '#FFF'});
675 });
676 }
677 if( !checkPrice( $("#order_tax").val() ) ) {
678 error++;
679 $("#order_tax").css({'background-color': '#FFA'}).click(function() {
680 $(this).css({'background-color': '#FFF'});
681 });
682 }
683
684 if( 0 < error ) {
685 $("#aniboxStatus").removeClass("none");
686 $("#aniboxStatus").addClass("error");
687 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
688 $("#info_massage").html("データに不備があります");
689 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
690 return false;
691 } else {
692 return true;
693 }
694 });
695 <?php do_action('usces_action_order_edit_page_js', $order_id, $data ); ?>
696 <?php echo apply_filters('usces_filter_order_edit_page_js', '', $order_id ); ?>
697 });
698
699 function toggleVisibility(id) {
700 var e = document.getElementById(id);
701 if(e.style.display == 'block') {
702 e.style.display = 'none';
703 //document.getElementById("searchSwitchStatus").value = 'OFF';
704 } else {
705 e.style.display = 'block';
706 //document.getElementById("searchSwitchStatus").value = 'ON';
707 //document.getElementById("searchVisiLink").style.display = 'none';
708 }
709 };
710
711 function addComma(str)
712 {
713 var strs = str.split('.');
714 cnt = 0;
715 n = "";
716 //20120606ysk start 0000497
717 m = "";
718 if( strs[0].substr(0, 1) == "-" ) {
719 m = "-";
720 strs[0] = strs[0].substr(1);
721 }
722 //20120606ysk end
723 for (i=strs[0].length-1; i>=0; i--)
724 {
725 n = strs[0].charAt(i) + n;
726 cnt++;
727 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
728 }
729 n = m + n;//20120606ysk 0000497
730 if(undefined != strs[1]){
731 res = n + '.' + strs[1];
732 }else{
733 res = n;
734 }
735 return res;
736 };
737
738 function pdfWindow( type ) {
739 var wx = 800;
740 var wy = 900;
741 var x = (screen.width- wx) / 2;
742 var y = (screen.height - wy) / 2;
743 x = 0;
744 y = 0;
745 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");
746 }
747 //20120606ysk start 0000497
748 function checkNumMinus( argValue ) {
749 if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
750 return false;
751 }
752 return true;
753 }
754 //20120606ysk end
755 //20120307ysk start 0000432
756 function delConfirm(){
757 if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
758 return true;
759 }else{
760 return false;
761 }
762 }
763 //20120307ysk end
764
765 jQuery(document).ready(function($){
766 //20120528ysk start 0000485
767 // var p = $("input[name*='skuPrice']");
768 // var q = $("input[name*='quant']");
769 // var t = $("td[id*='sub_total']");
770 // var db = $("input[name*='delButton']");
771
772 orderfunc.sumPrice(null);
773
774 // for( var i = 0; i < p.length; i++) {
775 // $(p[i]).live("change", function(){ orderfunc.sumPrice($(p[i])); });
776 // $(q[i]).live("change", function(){ orderfunc.sumPrice($(q[i])); });
777 // $(db[i]).live("click", function(){ return delConfirm($(db[i])); });
778 // }
779 $("input[name*='skuPrice']").live("change", function(){ orderfunc.sumPrice($(this)); });
780 $("input[name*='quant']").live("change", function(){ orderfunc.sumPrice($(this)); });
781 $("input[name*='delButton']").live("click", function(){ orderfunc.sumPrice(null); });
782 //20120528ysk end
783 $("#order_usedpoint").live("change", function(){ orderfunc.sumPrice($("#order_usedpoint")); });
784 $("#order_discount").live("change", function(){ orderfunc.sumPrice($("#order_discount")); });
785 $("#order_shipping_charge").live("change", function(){ orderfunc.sumPrice($("#order_shipping_charge")); });
786 $("#order_cod_fee").live("change", function(){ orderfunc.sumPrice($("#order_cod_fee")); });
787 $("#order_tax").live("change", function(){ orderfunc.sumPrice($("#order_tax")); });
788 $("input[name*='upButton']").click(function(){
789 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() ){
790 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"); ?>") ){
791 $('#up_modified').val('update');
792 }else{
793 $('#up_modified').val('');
794 }
795 }
796 return true;
797 });
798
799 //20120307ysk start 0000432
800 //function delConfirm(){
801 // if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
802 // return true;
803 // }else{
804 // return false;
805 // }
806 //}
807 //20120307ysk end
808
809 orderfunc.make_delivery_time(<?php echo $order_delivery_method; ?>);
810
811 $("#get_member").click(function(){
812 if( '' == $("input[name='customer[mailaddress]']").val() ){
813 alert('e-mail を�
814 �力して下さい。');
815 return;
816 }
817 if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
818 //20120914ysk start 0000567
819 //if( confirm('<?php _e("I will overwrite customer information, and shipping information. Would you like?", "usces"); ?>') ){
820 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") ){
821 //orderfunc.getMember($("input[name='customer[mailaddress]']").val());
822 return;
823 }
824 }
825 orderfunc.getMember($("input[name='customer[mailaddress]']").val());
826 //20120914ysk end
827 });
828 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
829 $("#costomercopy").click(function() {
830 if( '' != $("input[name='delivery[name1]']").val() ||
831 '' != $("input[name='delivery[name2]']").val() ||
832 '' != $("input[name='delivery[name3]']").val() ||
833 '' != $("input[name='delivery[name4]']").val() ||
834 '' != $("input[name='delivery[zipcode]']").val() ||
835 '' != $("input[name='delivery[address1]']").val() ||
836 '' != $("input[name='delivery[address2]']").val() ||
837 '' != $("input[name='delivery[address3]']").val() ||
838 '' != $("input[name='delivery[tel]']").val() ||
839 '' != $("input[name='delivery[fax]']").val() ) {
840 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") )
841 return;
842 }
843 $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
844 $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
845 $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
846 $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
847 $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
848 $("#delivery_country").val($("#customer_country option:selected").val());
849 $("#delivery_pref").val($("#customer_pref option:selected").val());
850 $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
851 $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
852 $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
853 $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
854 $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
855 });
856 <?php endif;//20120319ysk end ?>
857
858 $("#recalc").click(function(){ orderfunc.recalculation(); });
859 });
860 </script>
861 <div class="wrap">
862 <div class="usces_admin">
863 <form action="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action='.$oa; ?>" method="post" name="editpost">
864
865 <h2>Welcart Management <?php _e('Edit order data','usces'); ?></h2>
866 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
867 <div id="aniboxStatus" class="<?php echo $status; ?>">
868 <div id="anibox" class="clearfix">
869 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
870 <div class="mes" id="info_massage"><?php echo $message; ?></div>
871 </div>
872 </div>
873 <div class="mailVisiLink">
874 <a style="cursor:pointer;" id="mailVisiLink" onclick="toggleVisibility('mailBox');"><?php _e('show the mail/print field', 'usces'); ?></a><br /><a href="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>"><?php _e('Back', 'usces'); ?></a>
875 </div>
876 <div class="ordernavi"><input name="upButton" class="upButton" type="submit" value="<?php _e('change decision', 'usces'); ?>" /><?php _e("When you change amount, please click 'Edit' before you finish your process.", 'usces'); ?></div>
877 <div id="mailBox">
878 <table>
879 <tr>
880 <td><input name="check[ordermail]" type="checkbox" value="ordermail"<?php if(isset($ordercheck['ordermail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="orderConfirmMail"><?php _e('Mail for confirmation of order', 'usces'); ?></a></td>
881 <td><input name="check[changemail]" type="checkbox" value="changemail"<?php if(isset($ordercheck['changemail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="changeConfirmMail"><?php _e('Mail for confiemation of change', 'usces'); ?></a></td>
882 <td><input name="check[receiptmail]" type="checkbox" value="receiptmail"<?php if(isset($ordercheck['receiptmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="receiptConfirmMail"><?php _e('Mail for confirmation of transter', 'usces'); ?></a></td>
883 <td><input name="check[mitumorimail]" type="checkbox" value="mitumorimail"<?php if(isset($ordercheck['mitumorimail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="mitumoriConfirmMail"><?php _e('estimate mail', 'usces'); ?></a></td>
884 <td><input name="check[cancelmail]" type="checkbox" value="cancelmail"<?php if(isset($ordercheck['cancelmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="cancelConfirmMail"><?php _e('Cancelling mail', 'usces'); ?></a></td>
885 <td><input name="check[othermail]" type="checkbox" value="othermail"<?php if(isset($ordercheck['othermail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="otherConfirmMail"><?php _e('Other mail', 'usces'); ?></a></td>
886 </tr>
887 <tr>
888 <td><input name="check[completionmail]" type="checkbox" value="completionmail"<?php if(isset($ordercheck['completionmail'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="completionMail"><?php _e('Mail for Shipping', 'usces'); ?></a></td>
889 <td><input name="check[mitumoriprint]" type="checkbox" value="mitumoriprint"<?php if(isset($ordercheck['mitumoriprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="mitumoriprint"><?php _e('print out the estimate', 'usces'); ?></a></td>
890 <td><input name="check[nohinprint]" type="checkbox" value="nohinprint"<?php if(isset($ordercheck['nohinprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="nohinprint"><?php _e('print out Delivery Statement', 'usces'); ?></a></td>
891 <td><input name="check[billprint]" type="checkbox" value="billprint"<?php if(isset($ordercheck['billprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="billprint"><?php _e('Print Invoice', 'usces'); ?></a></td>
892 <td><input name="check[receiptprint]" type="checkbox" value="receiptprint"<?php if(isset($ordercheck['receiptprint'])) echo ' checked="checked"' ; ?> /></td><td><a href="#" id="receiptprint"><?php _e('Print Receipt', 'usces'); ?></a></td>
893 <?php echo apply_filters('usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
894 </tr>
895 <tr>
896 <td colspan="12"><span style="color:#CC3300"><?php _e("When there is any change, please press the 'change decision' before you send or print.", 'usces'); ?></span></td>
897 </tr>
898 </table>
899 </div>
900 <div class="info_head">
901 <table>
902 <tr>
903 <td colspan="6" class="midasi0"><?php _e('order details', 'usces'); ?></td>
904 </tr>
905 <?php do_action( 'usces_action_order_edit_form_detail_top', $data, $csod_meta ); ?>
906 <tr>
907 <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>
908 <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>
909 <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>
910 </tr>
911 <tr>
912 <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>
913 <td colspan="2" rowspan="10" class="wrap_td">
914 <table border="0" cellspacing="0" class="cus_info">
915 <tr>
916 <td class="label">e-mail</td>
917 <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>
918 </tr>
919
920 <?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
921
922 </table></td>
923 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
924 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?><input type="button" id="costomercopy" value="<?php _e("Same shipping address", "usces"); ?>"></td>
925 <?php else : ?>
926 <td colspan="2" class="midasi1"><?php _e('shipping address', 'usces'); ?></td>
927 <?php endif;//20120319ysk end ?>
928 </tr>
929 <tr>
930 <td class="label"><?php _e('payment method', 'usces'); ?></td>
931 <td class="col1"><select name="offer[payment_name]" id="order_payment_name">
932 <option value="#none#"><?php _e('-- Select --', 'usces'); ?></option>
933 <?php
934 if( $payment_method ) {
935 foreach ((array)$payment_method as $payments) {
936 if( $payments['name'] != '' ) {
937 $selected = (isset($data['order_payment_name']) && $payments['name'] == $data['order_payment_name']) ? ' selected="selected"' : '';
938 ?>
939 <option value="<?php echo esc_attr($payments['name']); ?>"<?php echo $selected; ?>><?php echo esc_attr($payments['name']); ?></option>
940 <?php } } } ?>
941 </select></td>
942 <td colspan="2" rowspan="9" class="wrap_td">
943 <table border="0" cellspacing="0" class="deli_info">
944
945 <?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
946
947 </table></td>
948 </tr>
949 <tr>
950 <td class="label"><?php _e('shipping option','usces'); ?></td>
951 <td class="col1"><select name="offer[delivery_method]" id="delivery_method_select">
952 <option value="-1"><?php _e('Non-request', 'usces'); ?></option>
953 <?php
954 foreach ((array)$this->options['delivery_method'] as $dkey => $delivery) {
955 $selected = $order_delivery_method == $delivery['id'] ? ' selected="selected"' : '';
956 echo "\t<option value='" . esc_attr($delivery['id']) . "'{$selected}>" . esc_attr($delivery['name']) . "</option>\n";
957 }
958 ?>
959 </select></td>
960 <?php //if( USCES_JP ): ?>
961 </tr>
962 <?php //endif; ?>
963 <!--20101208ysk start-->
964 <tr>
965 <td class="label"><?php _e('Delivery date', 'usces'); ?></td>
966 <td class="col1"><select name="offer[delivery_date]" id="delivery_date_select">
967 <?php
968 $delivery_days_select = '<option value="'.__('Non-request', 'usces').'">'.__('Non-request', 'usces').'</option>';
969 $data_order_date = explode(" ", $data['order_date']);
970 $order_date = explode("-", $data_order_date[0]);
971 //for($i = 0; $i < 50; $i++) {
972 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
973 $value = date('Y-m-d', mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
974 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,$order_date[1],$order_date[2]+$i,$order_date[0]));
975 $selected = (isset($data['order_delivery_date']) && $data['order_delivery_date'] == $value) ? ' selected="selected"' : '';
976 $delivery_days_select .= '<option value="'.$value.'"'.$selected.'>'.$date.'</option>';
977 }
978 ?>
979 <?php echo apply_filters( 'usces_filter_order_edit_delivery_days_select', $delivery_days_select, $data, $delivery_after_days ); ?>
980 </select></td>
981 </tr>
982 <!--20101208ysk end-->
983 <tr>
984 <td class="label"><?php _e('delivery time', 'usces'); ?></td>
985 <td class="col1">
986 <select name="offer[delivery_time]" id="delivery_time_select">
987 <option value="<?php _e('Non-request', 'usces'); ?>"><?php _e('Non-request', 'usces'); ?></option>
988 </select>
989 </td>
990 </tr>
991 <tr>
992 <td class="label"><?php _e('Shipping date', 'usces'); ?></td>
993 <td class="col1"><select name="offer[delidue_date]">
994 <option value="#none#"><?php _e('Not notified', 'usces'); ?></option>
995 <?php
996 //for ($i=0; $i<50; $i++) {
997 for($i = 0; $i < $delivery_after_days; $i++) {//20130527ysk 0000710
998 $value = date('Y-m-d', mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
999 $date = date(__( 'M j, Y', 'usces' ), mktime(0,0,0,date('m'),date('d')+$i,date('Y')));
1000 $selected = (isset($data['order_delidue_date']) && $data['order_delidue_date'] == $value) ? ' selected="selected"' : '';
1001 echo "\t<option value='{$value}'{$selected}>{$date}</option>\n";
1002 }
1003 ?>
1004 </select></td>
1005 </tr>
1006 <tr>
1007 <td colspan="2" class="midasi3"><?php _e('Status', 'usces'); ?></td>
1008 </tr>
1009 <tr>
1010 <td class="label status"><?php _e('The correspondence situation', 'usces'); ?></td>
1011 <td class="col1 status">
1012 <select name="offer[taio]" id="order_taio">
1013 <option value='#none#'><?php _e('new order', 'usces'); ?></option>
1014 <?php
1015 foreach ($management_status as $status_key => $status_name){
1016 if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
1017 continue;
1018 ?>
1019 <option value="<?php echo $status_key; ?>"<?php if($taio == $status_key){ echo ' selected="selected"';} ?>><?php echo $status_name; ?></option>
1020 <?php
1021 }
1022 ?>
1023 </select></td>
1024 </tr>
1025 <?php
1026 $receiptlabel = '&nbsp;';
1027 $receiptbox = '&nbsp;';
1028 if( $receipt != '' ) {
1029 $receiptlabel = __('transfer statement', 'usces');
1030 $selected = array( 'noreceipt'=>'', 'receipted'=>'', 'pending'=>'' );
1031 if( array_key_exists( $receipt, $selected ) ) $selected[$receipt] = ' selected="selected"';
1032 $receiptbox = '
1033 <select name="offer[receipt]">
1034 <option value="noreceipt"'.$selected['noreceipt'].'>'.$management_status['noreceipt'].'</option>
1035 <option value="receipted"'.$selected['receipted'].'>'.$management_status['receipted'].'</option>
1036 <option value="pending"'.$selected['pending'].'>'.$management_status['pending'].'</option>
1037 </select>';
1038 }
1039 ?>
1040 <tr>
1041 <td class="label status" id="receiptlabel"><?php echo( $receiptlabel ); ?></td>
1042 <td class="col1 status" id="receiptbox"><?php echo( $receiptbox ); ?></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 <?php if( 'products' == usces_get_tax_target() ) : ?>
1137 <tr>
1138 <td colspan="5" class="aright"><?php usces_tax_label($data); ?></td>
1139 <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>
1140 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1141 </tr>
1142 <?php endif ?>
1143 <tr>
1144 <td colspan="5" class="aright"><?php _e('Shipping', 'usces'); ?></td>
1145 <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>
1146 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1147 </tr>
1148 <tr>
1149 <td colspan="5" class="aright"><?php echo apply_filters('usces_filter_cod_label', __('COD fee', 'usces')); ?></td>
1150 <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>
1151 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1152 </tr>
1153 <?php if( 'all' == usces_get_tax_target() ) : ?>
1154 <tr>
1155 <td colspan="5" class="aright"><?php usces_tax_label($data); ?></td>
1156 <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>
1157 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1158 </tr>
1159 <?php endif ?>
1160 <tr>
1161 <td colspan="5" class="aright"><?php _e('Used points','usces'); ?></td>
1162 <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>
1163 <td><?php _e('granted points', 'usces'); ?></td>
1164 <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>
1165 </tr>
1166 <tr>
1167 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1168 <th id="total_full" class="aright">&nbsp;</th>
1169 <th colspan="2"><input name="recalc" id="recalc" class="addCartButton" type="button" value="<?php _e('Recalculation', 'usces'); ?>" /></th>
1170 </tr>
1171 </tfoot>
1172 </table>
1173 <?php
1174 $cart_table = ob_get_contents();
1175 ob_end_clean();
1176 echo apply_filters( 'usces_filter_ordereditform_carttable', $cart_table, $filter_args );
1177 ?>
1178 </div>
1179 <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>
1180
1181 <input name="order_action" type="hidden" value="<?php echo $oa; ?>" />
1182 <input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr(isset($data['ID']) ? $data['ID'] : ''); ?>" />
1183 <input name="old_getpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_getpoint']) ? $data['order_getpoint'] : ''); ?>" />
1184 <input name="old_usedpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_usedpoint']) ? $data['order_usedpoint'] : ''); ?>" />
1185 <input name="up_modified" id="up_modified" type="hidden" value="" />
1186 <input name="modified" id="modified" type="hidden" value="<?php echo esc_attr(isset($data['order_modified']) ? $data['order_modified'] : ''); ?>" />
1187
1188
1189
1190 <div id="dialog_parent" style="position:relative"></div>
1191 <div id="addItemDialog" title="<?php _e('Add item', 'usces'); ?>">
1192 <div id="order-response"></div>
1193 <fieldset>
1194 <div class="clearfix">
1195 <div class="dialogsearch">
1196 <label>商品カテゴリー </label>
1197 <?php
1198 $idObj = get_category_by_slug('item');
1199 $dropdown_options = array( 'show_option_none' => 'カテゴリーを選択して下さい', 'name' => 'newitemcategory', 'id' => 'newitemcategory', 'hide_empty' => 1, 'hierarchical' => 1, 'orderby' => 'name', 'child_of' => $idObj->term_id);
1200 wp_dropdown_categories($dropdown_options);
1201 ?>
1202 <br />
1203 <label>追加する商品 </label><select name="newitemcode" id="newitemcode"></select><br />
1204 <div id="loading"></div>
1205 <label for="name"><?php _e('item code', 'usces'); ?></label>
1206 <input type="text" name="newitemcodein" id="newitemcodein" class="text" />
1207 <input name="getitem" id="getitembutton" type="button" value="<?php _e('Obtain', 'usces'); ?>" onclick="if( jQuery('#newitemcodein').val() == '' ) return; orderItem.getitem(encodeURIComponent(jQuery('#newitemcodein').val()));" />
1208 </div>
1209 <div id="newitemform"></div>
1210 </div>
1211 </fieldset>
1212 </div>
1213
1214
1215
1216 <div id="mailSendDialog" title="">
1217 <div id="order-response"></div>
1218 <fieldset>
1219 <p><?php _e("Check the mail and click 'send'", 'usces'); ?></p>
1220 <label><?php _e('e-mail adress', 'usces'); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
1221 <label><?php _e('Client name', 'usces'); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
1222 <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 />
1223 <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
1224 <input name="mailChecked" id="mailChecked" type="hidden" />
1225 </fieldset>
1226 </div>
1227
1228 <div id="mailSendAlert" title="">
1229 <div id="order-response"></div>
1230 <fieldset>
1231 </fieldset>
1232 </div>
1233 <input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
1234 <?php wp_nonce_field( 'order_edit', 'wc_nonce' ); ?>
1235 </form>
1236
1237 <div id="PDFDialog" title="">
1238 <div id="pdf_response"></div>
1239 <fieldset>
1240 <div id="new_pdf"></div>
1241 </fieldset>
1242 </div>
1243 <?php do_action( 'usces_action_endof_order_edit_form', $data ); ?>
1244 </div><!--usces_admin-->
1245 </div><!--wrap-->
1246