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

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