PluginProbe
Welcart e-Commerce / 1.3.17
Welcart e-Commerce v1.3.17
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / order_edit_form.php

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

1,290 lines 55.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $status = $this->action_status;
3 $message = $this->action_message;
4 $this->action_status = 'none';
5 $this->action_message = '';
6
7 $pname = array();
8 $payment_method = array();
9
10 $management_status = apply_filters( 'usces_filter_management_status', get_option('usces_management_status') );
11 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
12 foreach( $payment_method as $pmet){
13 $pname[] = $pmet['name'];
14 }
15 if( !in_array( __('Transfer (prepayment)', 'usces'), $pname) ){
16 $newp['name'] = __('Transfer (prepayment)', 'usces');
17 $newp['explanation'] = '';
18 $newp['settlement'] = 'transferAdvance';
19 $newp['module'] = '';
20 $payment_method[] = $newp;
21 }
22 if( !in_array( __('Transfer (postpay)', 'usces'), $pname) ){
23 $newp['name'] = __('Transfer (postpay)', 'usces');
24 $newp['explanation'] = '';
25 $newp['settlement'] = 'transferDeferred';
26 $newp['module'] = '';
27 $payment_method[] = $newp;
28 }
29 if( !in_array( __('COD', 'usces'), $pname) ){
30 $newp['name'] = __('COD', 'usces');
31 $newp['explanation'] = '';
32 $newp['settlement'] = 'COD';
33 $newp['module'] = '';
34 $payment_method[] = $newp;
35 }
36
37 if($order_action == 'new'){
38
39 $oa = 'newpost';
40 $taio = 'new';
41 $admin = 'adminorder';
42 $receipt = '';
43 $ordercheck = array();
44 $order_delivery_method = -1;
45 $order_id = NULL;
46
47 $csod_meta = usces_has_custom_field_meta('order');
48 if(is_array($csod_meta)) {
49 $keys = array_keys($csod_meta);
50 foreach($keys as $key) {
51 $csod_key = 'csod_'.$key;
52 $csod_meta[$key]['data'] = NULL;
53 }
54 }
55 $cscs_meta = usces_has_custom_field_meta('customer');
56 if(is_array($cscs_meta)) {
57 $keys = array_keys($cscs_meta);
58 foreach($keys as $key) {
59 $cscs_key = 'cscs_'.$key;
60 $cscs_meta[$key]['data'] = NULL;
61 }
62 }
63 $csde_meta = usces_has_custom_field_meta('delivery');
64 if(is_array($csde_meta)) {
65 $keys = array_keys($csde_meta);
66 foreach($keys as $key) {
67 $csde_key = 'csde_'.$key;
68 $csde_meta[$key]['data'] = NULL;
69 }
70 }
71
72 $data = array(
73 'mem_name1' => '',
74 'mem_name2' => '',
75 'mem_name3' => '',
76 'mem_name4' => '',
77 'mem_zip' => '',
78 'mem_address1' => '',
79 'mem_address2' => '',
80 'mem_address3' => '',
81 'mem_tel' => '',
82 'mem_fax' => '',
83 'mem_country' => '',
84 'mem_pref' => '',
85 'order_name1' => '',
86 'order_name2' => '',
87 'order_name3' => '',
88 'order_name4' => '',
89 'order_zip' => '',
90 'order_address1' => '',
91 'order_address2' => '',
92 'order_address3' => '',
93 'order_tel' => '',
94 'order_fax' => '',
95 'order_country' => '',
96 'order_pref' => '',
97 'ID' => '',
98 'order_date' => current_time('mysql'),
99 'order_delivery_date' => '',
100 );
101 $deli = array(
102 'name1' => '',
103 'name2' => '',
104 'name3' => '',
105 'name4' => '',
106 'zipcode' => '',
107 'address1' => '',
108 'address2' => '',
109 'address3' => '',
110 'tel' => '',
111 'fax' => '',
112 'country' => '',
113 'pref' => ''
114 );
115 $condition = $this->get_condition();
116 $cart = array();
117
118
119 }else{
120
121 $oa = 'editpost';
122
123 $order_id = $_REQUEST['order_id'];
124
125 global $wpdb;
126
127 $tableName = $wpdb->prefix . "usces_order";
128 $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $order_id);
129 $data = $wpdb->get_row( $query, ARRAY_A );
130
131 $deli = stripslashes_deep(unserialize($data['order_delivery']));
132 $cart = stripslashes_deep(unserialize($data['order_cart']));
133 $condition = stripslashes_deep(unserialize($data['order_condition']));
134 $ordercheck = stripslashes_deep(unserialize($data['order_check']));
135 if( !is_array($ordercheck) ) $ordercheck = array();
136 $order_delivery_method = $data['order_delivery_method'];
137
138 if( !empty($data) ){
139 $data = stripslashes_deep($data);
140 }
141 foreach ($management_status as $status_key => $status_name){
142 if( in_array($status_key, array('noreceipt','receipted','pending', 'estimate', 'adminorder')) )
143 continue;
144
145 if($this->is_status($status_key, $data['order_status'])){
146 $taio = $status_key;
147 break;
148 }else{
149 $taio = 'new';
150 }
151 }
152
153 if($this->is_status('estimate', $data['order_status']))
154 $admin = 'estimate';
155 else if($this->is_status('adminorder', $data['order_status']))
156 $admin = 'adminorder';
157 else
158 $admin = '';
159
160 if($this->is_status('noreceipt', $data['order_status']))
161 $receipt = 'noreceipt';
162 else if($this->is_status('receipted', $data['order_status']))
163 $receipt = 'receipted';
164 else if($this->is_status('pending', $data['order_status']))
165 $receipt = 'pending';
166 else
167 $receipt = '';
168
169 //20100818ysk start
170 $csod_meta = usces_has_custom_field_meta('order');
171 if(is_array($csod_meta)) {
172 $keys = array_keys($csod_meta);
173 foreach($keys as $key) {
174 $csod_key = 'csod_'.$key;
175 $csod_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csod_key, $order_id));
176 }
177 }
178 $cscs_meta = usces_has_custom_field_meta('customer');
179 if(is_array($cscs_meta)) {
180 $keys = array_keys($cscs_meta);
181 foreach($keys as $key) {
182 $cscs_key = 'cscs_'.$key;
183 $cscs_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($cscs_key, $order_id));
184 }
185 }
186 $csde_meta = usces_has_custom_field_meta('delivery');
187 if(is_array($csde_meta)) {
188 $keys = array_keys($csde_meta);
189 foreach($keys as $key) {
190 $csde_key = 'csde_'.$key;
191 $csde_meta[$key]['data'] = maybe_unserialize($this->get_order_meta_value($csde_key, $order_id));
192 }
193 }
194 //20100818ysk end
195 }
196 $delivery_after_days = apply_filters( 'usces_filter_delivery_after_days', ( !empty($usces->options['delivery_after_days']) ? (int)$usces->options['delivery_after_days'] : 100 ) );//20130527ysk 0000710
197 ?>
198 <script type="text/javascript">
199 jQuery(function($){
200 <?php if($status == 'success'){ ?>
201 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
202 <?php }else if($status == 'caution'){ ?>
203 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
204 <?php }else if($status == 'error'){ ?>
205 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
206 <?php } ?>
207 var selected_delivery_time = '<?php esc_html_e(isset($data['order_delivery_time']) ? $data['order_delivery_time'] : ''); ?>';
208 var delivery_time = [];
209 <?php
210 foreach((array)$this->options['delivery_method'] as $dmid => $dm){
211 $lines = explode("\n", $dm['time']);
212 ?>
213 delivery_time[<?php echo $dm['id']; ?>] = [];
214 <?php
215 foreach((array)$lines as $line){
216 if(trim($line) != ''){
217 ?>
218 delivery_time[<?php echo $dm['id']; ?>].push("<?php echo trim($line); ?>");
219 <?php }
220 }
221 }
222 ?>
223
224 $("#order_payment_name").change(function () {
225 var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
226 //20101018ysk start
227 //if( uscesPayments[pay_name] == 'transferAdvance' || uscesPayments[pay_name] == 'transferDeferred'){
228 if( uscesPayments[pay_name] == 'transferAdvance'
229 || uscesPayments[pay_name] == 'transferDeferred'
230 || uscesPayments[pay_name] == 'acting_remise_conv'
231 || uscesPayments[pay_name] == 'acting_zeus_bank'
232 || uscesPayments[pay_name] == 'acting_zeus_conv'
233 || uscesPayments[pay_name] == 'acting_jpayment_conv'
234 || uscesPayments[pay_name] == 'acting_jpayment_bank'){
235 //20101018ysk end
236 var label = '<?php _e('transfer statement', 'usces'); ?>';
237 var html = "<select name='offer[receipt]'>\n";
238 html += "<option value='noreceipt'><?php echo $management_status['noreceipt']; ?></option>\n";
239 html += "<option value='receipted'><?php echo $management_status['receipted']; ?></option>\n";
240 html += "</select>\n";
241 $("#receiptlabel").html(label);
242 $("#receiptbox").html(html);
243 }else{
244 $("#receiptlabel").html('');
245 $("#receiptbox").html('');
246 }
247 });
248
249 $("#addItemDialog").dialog({
250 bgiframe: true,
251 autoOpen: false,
252 height: 500,
253 width: 700,
254 resizable: true,
255 modal: true,
256 buttons: {
257 '<?php _e('close', 'usces'); ?>': function() {
258 $(this).dialog('close');
259 }
260 },
261 close: function() {
262 $("#newitemform").html( "" );
263 $('#newitemcode').val('');
264 }
265 });
266 $('#addCartButton').click(function() {
267 if($("input[name='order_id']").val() == ''){
268 alert("<?php _e("Push 'change decision' button, to be settled with an order number.", 'usces'); ?>");
269 return;
270 }
271 $('#addItemDialog').dialog('open');
272 });
273 $('#delivery_method_select').change(function() {
274 orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
275 });
276
277 $("#mailSendDialog").dialog({
278 bgiframe: true,
279 autoOpen: false,
280 height: 650,
281 width: 700,
282 resizable: true,
283 modal: true,
284 buttons: {
285 '<?php _e('close', 'usces'); ?>': function() {
286 $(this).dialog('close');
287 }
288 },
289 close: function() {
290 $("#sendmailmessage").html( "" );
291 $('#sendmailaddress').val('');
292 }
293 });
294 $('#completionMail').click(function() {
295 orderItem.getmailmessage('completionMail');
296 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
297 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
298 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['completionmail'], $data, 'completionMail')); ?>');
299 $('#mailChecked').val('completionmail');
300 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for Shipping', 'usces'); ?>');
301 $('#mailSendDialog').dialog('open');
302 });
303 $('#orderConfirmMail').click(function() {
304 orderItem.getmailmessage('orderConfirmMail');
305 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
306 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
307 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['ordermail'], $data, 'orderConfirmMail')); ?>');
308 $('#mailChecked').val('ordermail');
309 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of order', 'usces'); ?>');
310 $('#mailSendDialog').dialog('open');
311 });
312 $('#changeConfirmMail').click(function() {
313 orderItem.getmailmessage('changeConfirmMail');
314 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
315 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
316 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['changemail'], $data, 'changeConfirmMail')); ?>');
317 $('#mailChecked').val('changemail');
318 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confiemation of change', 'usces'); ?>');
319 $('#mailSendDialog').dialog('open');
320 });
321 $('#receiptConfirmMail').click(function() {
322 orderItem.getmailmessage('receiptConfirmMail');
323 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
324 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
325 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['receiptmail'], $data, 'receiptConfirmMail')); ?>');
326 $('#mailChecked').val('receiptmail');
327 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Mail for confirmation of transter', 'usces'); ?>');
328 $('#mailSendDialog').dialog('open');
329 });
330 $('#mitumoriConfirmMail').click(function() {
331 orderItem.getmailmessage('mitumoriConfirmMail');
332 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
333 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
334 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['mitumorimail'], $data, 'mitumoriConfirmMail')); ?>');
335 $('#mailChecked').val('mitumorimail');
336 $('#mailSendDialog').dialog('option', 'title', '<?php _e('estimate mail', 'usces'); ?>');
337 $('#mailSendDialog').dialog('open');
338 });
339 $('#cancelConfirmMail').click(function() {
340 orderItem.getmailmessage('cancelConfirmMail');
341 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
342 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
343 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['cancelmail'], $data, 'cancelConfirmMail')); ?>');
344 $('#mailChecked').val('cancelmail');
345 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Cancelling mail', 'usces'); ?>');
346 $('#mailSendDialog').dialog('open');
347 });
348 $('#otherConfirmMail').click(function() {
349 orderItem.getmailmessage('otherConfirmMail');
350 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
351 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
352 $("#sendmailsubject").val('<?php echo esc_js(apply_filters('usces_filter_order_confirm_mail_subject', $this->options['mail_data']['title']['othermail'], $data, 'otherConfirmMail')); ?>');
353 $('#mailChecked').val('othermail');
354 $('#mailSendDialog').dialog('option', 'title', '<?php _e('Other mail', 'usces'); ?>');
355 $('#mailSendDialog').dialog('open');
356 });
357
358 $("#mailSendAlert").dialog({
359 bgiframe: true,
360 autoOpen: false,
361 height: 200,
362 width: 200,
363 resizable: false,
364 modal: false
365 });
366 $("#sendmail").click(function() {
367 uscesMail.sendmail();
368 });
369
370 $("#PDFDialog").dialog({
371 bgiframe: true,
372 autoOpen: false,
373 height: 800,
374 width: 700,
375 resizable: true,
376 modal: true,
377 buttons: {
378 '<?php _e('close', 'usces'); ?>': function() {
379 $(this).dialog('close');
380 }
381 },
382 close: function() {
383 $("#new_pdf").html( "" );
384 }
385 });
386 $('#mitumoriprint').click(function() {
387 $('#new_pdf').html('<iframe src="<?php echo 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 post_ids = '';
498 var skus = '';
499 var prices = '';
500 var quants = '';
501 for( var i = 0; i < p.length; i++) {
502 name = $(p[i]).attr(\"name\");
503 strs = name.split('[');
504 post_ids += strs[2].replace(/[\]]+$/g, '')+'#usces#';
505 skus += strs[3].replace(/[\]]+$/g, '')+'#usces#';
506 prices += parseFloat($(p[i]).val())+'#usces#';
507 quants += $(q[i]).val()+'#usces#';
508 }
509 var order_usedpoint = $(\"#order_usedpoint\").val()*1;
510 var order_shipping_charge = parseFloat($(\"#order_shipping_charge\").val());
511 var order_cod_fee = parseFloat($(\"#order_cod_fee\").val());
512 var s = orderfunc.settings;
513 s.url = uscesL10n.requestFile;
514 s.data = 'action=order_item_ajax&mode=recalculation&order_id='+$('#order_id').val()+'&mem_id='+$('#member_id_label').html()+'&post_ids='+post_ids+'&skus='+skus+'&prices='+prices+'&quants='+quants+'&use_point='+order_usedpoint+'&shipping_charge='+order_shipping_charge+'&cod_fee='+order_cod_fee;
515 s.success = function(data, dataType) {
516 var values = data.split('#usces#');
517 if( 'ok' == values[0] ) {
518 $(\"#order_discount\").val(values[1]);
519 $(\"#order_tax\").val(values[2]);
520 $(\"#order_getpoint\").val(values[3]);
521 $(\"#total_full\").html(addComma(values[4]+''));
522 $(\"#total_full_top\").html(addComma(values[4]+''));
523 } else {
524 alert( 'ERROR' );
525 }
526 };
527 s.error = function(data, dataType) {
528 alert( 'ERROR' );
529 };
530 $.ajax( s );
531 return false;
532 ";
533 echo apply_filters( 'order_edit_form_recalculation',$script, $data);
534 ?>
535 },
536 settings: {
537 url: uscesL10n.requestFile,
538 type: 'POST',
539 cache: false,
540 success: function(data, dataType){
541 },
542 error: function(msg){
543 //$("#ajax-response").html(msg);
544 }
545 }
546 };
547
548 uscesMail = {
549 sendmail : function() {
550 if($("#sendmailaddress").val() == "") return;
551
552 var address = encodeURIComponent($("#sendmailaddress").val());
553 var message = encodeURIComponent($("#sendmailmessage").val());
554 var name = encodeURIComponent($("#sendmailname").val());
555 var subject = encodeURIComponent($("#sendmailsubject").val());
556 var order_id = $("#order_id").val();
557 var checked = $("#mailChecked").val();
558
559 var s = uscesMail.settings;
560 s.data = "action=order_item_ajax&mode=sendmail&mailaddress=" + address + "&message=" + message + "&name=" + name + "&subject=" + subject + "&order_id=" + order_id + "&checked=" + checked;
561 s.success = function(data, dataType){
562 if(data == 'success') {
563 if(checked == 'completionmail'){
564 $("input[name='check\[completionmail\]']").attr({checked: true});
565 }else if(checked == 'ordermail'){
566 $("input[name='check\[ordermail\]']").attr({checked: true});
567 }else if(checked == 'changemail'){
568 $("input[name='check\[changemail\]']").attr({checked: true});
569 }else if(checked == 'receiptmail'){
570 $("input[name='check\[receiptmail\]']").attr({checked: true});
571 }else if(checked == 'mitumorimail'){
572 $("input[name='check\[mitumorimail\]']").attr({checked: true});
573 }else if(checked == 'cancelmail'){
574 $("input[name='check\[cancelmail\]']").attr({checked: true});
575 }else if(checked == 'othermail'){
576 $("input[name='check\[othermail\]']").attr({checked: true});
577 }
578 <?php echo apply_filters('usces_filter_order_check_mail_js', '' ); ?>
579
580 $('#mailSendAlert').dialog('option', 'buttons', {
581 'OK': function() {
582 $(this).dialog('close');
583 $('#mailSendDialog').dialog('close');
584 }
585 });
586 $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
587 $('#mailSendAlert fieldset').html('<p><?php _e('E-mail has been sent.', 'usces'); ?></p>');
588 $('#mailSendAlert').dialog('open');
589
590 }else if(data == 'error'){
591 $('#mailSendAlert').dialog('option', 'buttons', {
592 'OK': function() {
593 $(this).dialog('close');
594 }
595 });
596 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
597 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
598 $('#mailSendAlert').dialog('open');
599 }
600 };
601 s.error = function(data, dataType){
602 $('#mailSendAlert').dialog('option', 'buttons', {
603 'OK': function() {
604 $(this).dialog('close');
605 }
606 });
607 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
608 $('#mailSendAlert fieldset').html('<p><?php _e('Failure in sending e-mails.', 'usces'); ?></p>');
609 $('#mailSendAlert').dialog('open');
610 };
611 $.ajax( s );
612 return false;
613 },
614 ordercheckpost : function( checked ) {
615 var p = uscesMail.settings;
616 var order_id = $("#order_id").val();
617 p.url = uscesL10n.requestFile;
618 p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked;
619 p.success = function(data, dataType){
620 if(data == 'mitumoriprint'){
621 $("input[name='check\[mitumoriprint\]']").attr({checked: true});
622 }else if(data == 'nohinprint'){
623 $("input[name='check\[nohinprint\]']").attr({checked: true});
624 }
625 <?php echo apply_filters('usces_filter_order_check_print_js', '' ); ?>
626 };
627 p.error = function(data, dataType){
628 //$("#ajax-response").html(msg);
629 };
630 $.ajax( p );
631 return false;
632 },
633 settings: {
634 url: uscesL10n.requestFile,
635 type: 'POST',
636 cache: false,
637 success: function(data, dataType){
638 },
639 error: function(msg){
640 //$("#ajax-response").html(msg);
641 }
642 }
643 };
644
645 $('form').submit(function() {
646 var error = 0;
647
648 if( !checkNum( $("#order_usedpoint").val() ) ) {
649 error++;
650 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
651 $(this).css({'background-color': '#FFF'});
652 });
653 }
654 if( !checkNum( $("#order_getdpoint").val() ) ) {
655 error++;
656 $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
657 $(this).css({'background-color': '#FFF'});
658 });
659 }
660 if( !checkPrice( $("#order_discount").val() ) ) {
661 error++;
662 $("#order_discount").css({'background-color': '#FFA'}).click(function() {
663 $(this).css({'background-color': '#FFF'});
664 });
665 }
666 if( !checkPrice( $("#order_shipping_charge").val() ) ) {
667 error++;
668 $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
669 $(this).css({'background-color': '#FFF'});
670 });
671 }
672 if( !checkPrice( $("#order_cod_fee").val() ) ) {
673 error++;
674 $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
675 $(this).css({'background-color': '#FFF'});
676 });
677 }
678 if( !checkPrice( $("#order_tax").val() ) ) {
679 error++;
680 $("#order_tax").css({'background-color': '#FFA'}).click(function() {
681 $(this).css({'background-color': '#FFF'});
682 });
683 }
684
685 if( 0 < error ) {
686 $("#aniboxStatus").removeClass("none");
687 $("#aniboxStatus").addClass("error");
688 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
689 $("#info_massage").html("データに不備があります");
690 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
691 return false;
692 } else {
693 return true;
694 }
695 });
696 <?php do_action('usces_action_order_edit_page_js', $order_id, $data ); ?>
697 <?php echo apply_filters('usces_filter_order_edit_page_js', '', $order_id ); ?>
698 });
699
700 function toggleVisibility(id) {
701 var e = document.getElementById(id);
702 if(e.style.display == 'block') {
703 e.style.display = 'none';
704 //document.getElementById("searchSwitchStatus").value = 'OFF';
705 } else {
706 e.style.display = 'block';
707 //document.getElementById("searchSwitchStatus").value = 'ON';
708 //document.getElementById("searchVisiLink").style.display = 'none';
709 }
710 };
711
712 function addComma(str)
713 {
714 var strs = str.split('.');
715 cnt = 0;
716 n = "";
717 //20120606ysk start 0000497
718 m = "";
719 if( strs[0].substr(0, 1) == "-" ) {
720 m = "-";
721 strs[0] = strs[0].substr(1);
722 }
723 //20120606ysk end
724 for (i=strs[0].length-1; i>=0; i--)
725 {
726 n = strs[0].charAt(i) + n;
727 cnt++;
728 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
729 }
730 n = m + n;//20120606ysk 0000497
731 if(undefined != strs[1]){
732 res = n + '.' + strs[1];
733 }else{
734 res = n;
735 }
736 return res;
737 };
738
739 function pdfWindow( type ) {
740 var wx = 800;
741 var wy = 900;
742 var x = (screen.width- wx) / 2;
743 var y = (screen.height - wy) / 2;
744 x = 0;
745 y = 0;
746 printWin = window.open("<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action=pdfout&order_id='.$order_id; ?>"+"&type="+type,"sub","left="+x+",top="+y+",width="+wx+",height="+wy+",scrollbars=yes");
747 }
748 //20120606ysk start 0000497
749 function checkNumMinus( argValue ) {
750 if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
751 return false;
752 }
753 return true;
754 }
755 //20120606ysk end
756 //20120307ysk start 0000432
757 function delConfirm(){
758 if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
759 return true;
760 }else{
761 return false;
762 }
763 }
764 //20120307ysk end
765
766 jQuery(document).ready(function($){
767 //20120528ysk start 0000485
768 // var p = $("input[name*='skuPrice']");
769 // var q = $("input[name*='quant']");
770 // var t = $("td[id*='sub_total']");
771 // var db = $("input[name*='delButton']");
772
773 orderfunc.sumPrice(null);
774
775 // for( var i = 0; i < p.length; i++) {
776 // $(p[i]).bind("change", function(){ orderfunc.sumPrice($(p[i])); });
777 // $(q[i]).bind("change", function(){ orderfunc.sumPrice($(q[i])); });
778 // $(db[i]).bind("click", function(){ return delConfirm($(db[i])); });
779 // }
780 $("input[name*='skuPrice']").bind("change", function(){ orderfunc.sumPrice($(this)); });
781 $("input[name*='quant']").bind("change", function(){ orderfunc.sumPrice($(this)); });
782 $("input[name*='delButton']").bind("click", function(){ orderfunc.sumPrice(null); });
783 //20120528ysk end
784 $("#order_usedpoint").bind("change", function(){ orderfunc.sumPrice($("#order_usedpoint")); });
785 $("#order_discount").bind("change", function(){ orderfunc.sumPrice($("#order_discount")); });
786 $("#order_shipping_charge").bind("change", function(){ orderfunc.sumPrice($("#order_shipping_charge")); });
787 $("#order_cod_fee").bind("change", function(){ orderfunc.sumPrice($("#order_cod_fee")); });
788 $("#order_tax").bind("change", function(){ orderfunc.sumPrice($("#order_tax")); });
789 $("input[name*='upButton']").click(function(){
790 if( ('completion' == $("#order_taio option:selected").val() || 'continuation' == $("#order_taio option:selected").val()) && '<?php echo substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); ?>' != $('#modified').val() ){
791 if( confirm("<?php _e("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"); ?>") ){
792 $('#up_modified').val('update');
793 }else{
794 $('#up_modified').val('');
795 }
796 }
797 return true;
798 });
799
800 //20120307ysk start 0000432
801 //function delConfirm(){
802 // if(confirm('<?php _e('Are you sure of deleting items?', 'usces'); ?>')){
803 // return true;
804 // }else{
805 // return false;
806 // }
807 //}
808 //20120307ysk end
809
810 orderfunc.make_delivery_time(<?php echo $order_delivery_method; ?>);
811
812 $("#get_member").click(function(){
813 if( '' == $("input[name='customer[mailaddress]']").val() ){
814 alert('e-mail を�
815 �力して下さい。');
816 return;
817 }
818 if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
819 //20120914ysk start 0000567
820 //if( confirm('<?php _e("I will overwrite customer information, and shipping information. Would you like?", "usces"); ?>') ){
821 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") ){
822 //orderfunc.getMember($("input[name='customer[mailaddress]']").val());
823 return;
824 }
825 }
826 orderfunc.getMember($("input[name='customer[mailaddress]']").val());
827 //20120914ysk end
828 });
829 <?php if($order_action == 'new') ://20120319ysk start 0000441 ?>
830 $("#costomercopy").click(function() {
831 if( '' != $("input[name='delivery[name1]']").val() ||
832 '' != $("input[name='delivery[name2]']").val() ||
833 '' != $("input[name='delivery[name3]']").val() ||
834 '' != $("input[name='delivery[name4]']").val() ||
835 '' != $("input[name='delivery[zipcode]']").val() ||
836 '' != $("input[name='delivery[address1]']").val() ||
837 '' != $("input[name='delivery[address2]']").val() ||
838 '' != $("input[name='delivery[address3]']").val() ||
839 '' != $("input[name='delivery[tel]']").val() ||
840 '' != $("input[name='delivery[fax]']").val() ) {
841 if( !confirm("<?php _e("I will overwrite the ship-to address the customer's address. Would you like?", "usces"); ?>") )
842 return;
843 }
844 $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
845 $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
846 $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
847 $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
848 $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
849 $("#delivery_country").val($("#customer_country option:selected").val());
850 $("#delivery_pref").val($("#customer_pref option:selected").val());
851 $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
852 $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
853 $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
854 $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
855 $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
856 });
857 <?php endif;//20120319ysk end ?>
858
859 $("#recalc").click(function(){ orderfunc.recalculation(); });
860 });
861 </script>
862 <div class="wrap">
863 <div class="usces_admin">
864 <form action="<?php echo USCES_ADMIN_URL.'?page=usces_orderlist&order_action='.$oa; ?>" method="post" name="editpost">
865
866 <h2>Welcart Management <?php _e('Edit order data','usces'); ?></h2>
867 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
868 <div id="aniboxStatus" class="<?php echo $status; ?>">
869 <div id="anibox" class="clearfix">
870 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
871 <div class="mes" id="info_massage"><?php echo $message; ?></div>
872 </div>
873 </div>
874 <div class="mailVisiLink">
875 <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>
876 </div>
877 <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>
878 <div id="mailBox">
879 <table>
880 <tr>
881 <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>
882 <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>
883 <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>
884 <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>
885 <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>
886 <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>
887 </tr>
888 <tr>
889 <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>
890 <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>
891 <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>
892 <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>
893 <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>
894 <?php echo apply_filters('usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
895 </tr>
896 <tr>
897 <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>
898 </tr>
899 </table>
900 </div>
901 <div class="info_head">
902 <table>
903 <tr>
904 <td colspan="6" class="midasi0"><?php _e('order details', 'usces'); ?></td>
905 </tr>
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 <tr>
1026 <td class="label status" id="receiptlabel"><?php if($receipt != ''){echo __('transfer statement', 'usces');}else{echo '&nbsp';} ?></td>
1027 <td class="col1 status" id="receiptbox">
1028 <?php if($receipt != '') : ?>
1029 <select name="offer[receipt]">
1030 <option value='noreceipt'<?php if($receipt == 'noreceipt'){ echo ' selected="selected"';} ?>><?php echo $management_status['noreceipt']; ?></option>
1031 <option value='receipted'<?php if($receipt == 'receipted'){ echo ' selected="selected"';} ?>><?php echo $management_status['receipted']; ?></option>
1032 <option value='pending'<?php if($receipt == 'pending'){ echo ' selected="selected"';} ?>><?php echo $management_status['pending']; ?></option>
1033 </select>
1034 <?php else : ?>
1035 &nbsp
1036 <?php endif; ?>
1037 </td>
1038 </tr>
1039 <tr>
1040 <td class="label status"><?php if($admin != ''){echo __('estimate order', 'usces');}else{echo '&nbsp';} ?></td>
1041 <td class="col1 status">
1042 <?php if($admin != '') : ?>
1043 <select name="offer[admin]">
1044 <option value='adminorder'<?php if($admin == 'adminorder'){ echo 'selected="selected"';} ?>><?php echo $management_status['adminorder']; ?></option>
1045 <option value='estimate'<?php if($admin == 'estimate'){ echo 'selected="selected"';} ?>><?php echo $management_status['estimate']; ?></option>
1046 </select>
1047 <?php else : ?>
1048 &nbsp
1049 <?php endif; ?></td>
1050 </tr>
1051 <tr>
1052 <td colspan="2" class="status">
1053 <div class="midasi2"><?php if($condition['display_mode'] == 'Usualsale'){echo __('normal sale', 'usces');}elseif($condition['display_mode'] == 'Promotionsale'){echo __('Sale Campaign', 'usces');} ?></div>
1054 <div class="condition">
1055 <?php if ( $condition['display_mode'] == 'Promotionsale' ) : ?>
1056 <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 />
1057 <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 />
1058 <?php endif; ?>
1059 </div></td>
1060 <td class="label"><?php _e('Notes', 'usces'); ?></td>
1061 <td colspan="3"><textarea name="offer[note]"><?php echo esc_attr(isset($data['order_note']) ? $data['order_note'] : ''); ?></textarea></td>
1062 </tr>
1063 </table>
1064 </div>
1065 <?php //if( $this->has_order_custom_info( $order_id ) ): ?>
1066 <div class="info_head">
1067 <table>
1068 <tr>
1069 <td class="midasi0"><?php _e('Custom order field', 'usces'); ?></td>
1070 <td class="midasi0"><?php _e('Payment information', 'usces'); ?></td>
1071 </tr>
1072 <tr>
1073 <td class="wrap_td">
1074 <table class="order_custom_wrap">
1075 <tr>
1076 <?php do_action( 'usces_action_order_edit_form_custom', $data, $csod_meta ); ?>
1077 <?php
1078 //20100818ysk start
1079 usces_admin_custom_field_input($csod_meta, 'order', '');
1080 //20100818ysk end
1081 ?>
1082 </tr>
1083
1084 </table>
1085 </td>
1086 <td class="wrap_td">
1087 <table class="settle_info_wrap">
1088 <?php usces_settle_info_field( $order_id, 'tr' ); ?>
1089 </table>
1090 </td>
1091 </tr>
1092 </table>
1093 </div>
1094 <?php //endif; ?>
1095 <div id="cart">
1096 <table cellspacing="0" id="cart_table">
1097 <thead>
1098 <tr>
1099 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1100 <th id="total_full_top" class="aright">&nbsp;</th>
1101 <th colspan="2">&nbsp;<?php _e('Currency','usces'); ?>(<?php usces_crcode(); ?>)</th>
1102 </tr>
1103 <tr>
1104 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
1105 <th class="thumbnail"> <?php //echo __('thumbnail','usces'); ?></th>
1106 <th><?php _e('Items','usces'); ?></th>
1107 <th class="price"><?php _e('Unit price','usces'); ?></th>
1108 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
1109 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
1110 <th class="stock"><?php _e('Current stock', 'usces'); ?></th>
1111 <th class="action"><input name="addButton" id="addCartButton" class="addCartButton" type="button" value="<?php _e('Add item', 'usces'); ?>" /></th>
1112 </tr>
1113 </thead>
1114 <tbody id="orderitemlist">
1115 <?php
1116 global $post;
1117 for($i=0; $i<count($cart); $i++) {
1118 $cart_row = $cart[$i];
1119 $post_id = $cart_row['post_id'];
1120 $post = get_post($post_id);
1121 $sku = $cart_row['sku'];
1122 $sku_code = esc_attr(urldecode($cart_row['sku']));
1123 $quantity = $cart_row['quantity'];
1124 $options = $cart_row['options'];
1125 $advance = $this->cart->wc_serialize($cart_row['advance']);
1126 $itemCode = $this->getItemCode($post_id);
1127 $itemName = $this->getItemName($post_id);
1128 $cartItemName = $this->getCartItemName($post_id, $sku_code);
1129 $skuPrice = $cart_row['price'];
1130 $stock = $this->getItemZaiko($post_id, $sku_code);
1131 $red = (in_array($stock, array(__('sellout', 'usces'), __('Out Of Stock', 'usces'), __('Out of print', 'usces')))) ? 'class="signal_red"' : '';
1132 $pictid = (int)$this->get_mainpictid($itemCode);
1133 if( empty($options) ) {
1134 $optstr = '';
1135 $options = array();
1136 }
1137 if( is_array($options) && count($options) > 0 ){
1138 $optstr = '';
1139 foreach($options as $key => $value){
1140 //20110629ysk start 0000190
1141 //if( !empty($key) )
1142 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1143 if( !empty($key) ) {
1144 $key = urldecode($key);
1145 if(is_array($value)) {
1146 $c = '';
1147 $optstr .= esc_html($key) . ' : ';
1148 foreach($value as $v) {
1149 $optstr .= $c.nl2br(esc_html(urldecode($v)));
1150 $c = ', ';
1151 }
1152 $optstr .= "<br />\n";
1153 } else {
1154 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
1155 }
1156 }
1157 //20110629ysk end
1158 }
1159 }
1160 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'sku_code', 'quantity', 'options', 'advance',
1161 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'stock', 'red', 'pictid', 'order_id' );
1162 $optstr = apply_filters( 'usces_filter_order_edit_form_row', $optstr, $cart, $materials );
1163 ?>
1164 <tr>
1165 <td><?php echo $i + 1; ?></td>
1166 <td><?php echo wp_get_attachment_image( $pictid, array(150, 150), true ); ?></td>
1167 <td class="aleft"><?php echo esc_html($cartItemName); ?><?php do_action('usces_admin_order_item_name', $order_id, $i); ?><br /><?php echo $optstr; ?></td>
1168 <td><input name="skuPrice[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="text price" type="text" value="<?php echo esc_attr( $skuPrice ); ?>" /></td>
1169 <td><input name="quant[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="text quantity" type="text" value="<?php echo esc_attr($cart_row['quantity']); ?>" /></td>
1170 <td id="sub_total[<?php echo $i; ?>]" class="aright">&nbsp;</td>
1171 <td <?php echo $red ?>><?php echo esc_html($stock); ?></td>
1172 <td>
1173 <?php foreach((array)$options as $key => $value){ ?>
1174 <input name="optName[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo esc_attr($key); ?>" />
1175 <?php if(is_array($value)): //20110715ysk 0000202 ?>
1176 <?php foreach($value as $v): ?>
1177 <input name="itemOption[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>][<?php echo $v; ?>]" type="hidden" value="<?php echo $v; ?>" />
1178 <?php endforeach; ?>
1179 <?php else: ?>
1180 <input name="itemOption[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>][<?php echo $key; ?>]" type="hidden" value="<?php echo $value; ?>" />
1181 <?php endif; ?>
1182 <?php } ?>
1183 <input name="advance[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" type="hidden" value="<?php echo esc_attr($advance); ?>" />
1184 <input name="delButton[<?php echo $i; ?>][<?php echo $post_id; ?>][<?php echo $sku; ?>]" class="delCartButton" type="submit" value="<?php _e('Delete', 'usces'); ?>" />
1185 <?php do_action('usces_admin_order_cart_button', $order_id, $i); ?>
1186 </td>
1187 </tr>
1188 <?php
1189 }
1190 ?>
1191 </tbody>
1192 <tfoot>
1193 <tr>
1194 <th colspan="5" class="aright"><?php _e('total items','usces'); ?></th>
1195 <th id="item_total" class="aright">&nbsp;</th>
1196 <th colspan="2">&nbsp;</th>
1197 </tr>
1198 <tr>
1199 <td colspan="5" class="aright"><?php _e('Used points','usces'); ?></td>
1200 <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>
1201 <td><?php _e('granted points', 'usces'); ?></td>
1202 <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>
1203 </tr>
1204 <tr>
1205 <td colspan="5" class="aright"><?php echo apply_filters('usces_confirm_discount_label', __('Campaign disnount', 'usces'), $order_id); ?></td>
1206 <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>
1207 <td colspan="2"><?php _e('Discounted amount should be shown by -(Minus)', 'usces'); ?>&nbsp;</td>
1208 </tr>
1209 <tr>
1210 <td colspan="5" class="aright"><?php _e('Shipping', 'usces'); ?></td>
1211 <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>
1212 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1213 </tr>
1214 <tr>
1215 <td colspan="5" class="aright"><?php echo apply_filters('usces_filter_cod_label', __('COD fee', 'usces')); ?></td>
1216 <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>
1217 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1218 </tr>
1219 <tr>
1220 <td colspan="5" class="aright"><?php _e('consumption tax', 'usces'); ?></td>
1221 <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>
1222 <td colspan="2"><?php _e('It will be not caluculated automatically.', 'usces'); ?>&nbsp;</td>
1223 </tr>
1224 <tr>
1225 <th colspan="5" class="aright"><?php _e('Total Amount','usces'); ?></th>
1226 <th id="total_full" class="aright">&nbsp;</th>
1227 <th colspan="2"><input name="recalc" id="recalc" class="addCartButton" type="button" value="<?php _e('Recalculation', 'usces'); ?>" /></th>
1228 </tr>
1229 </tfoot>
1230 </table>
1231 </div>
1232 <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>
1233
1234 <input name="order_action" type="hidden" value="<?php echo $oa; ?>" />
1235 <input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr(isset($data['ID']) ? $data['ID'] : ''); ?>" />
1236 <input name="old_getpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_getpoint']) ? $data['order_getpoint'] : ''); ?>" />
1237 <input name="old_usedpoint" type="hidden" value="<?php echo esc_attr(isset($data['order_usedpoint']) ? $data['order_usedpoint'] : ''); ?>" />
1238 <input name="up_modified" id="up_modified" type="hidden" value="" />
1239 <input name="modified" id="modified" type="hidden" value="<?php echo esc_attr(isset($data['order_modified']) ? $data['order_modified'] : ''); ?>" />
1240
1241
1242
1243
1244 <div id="addItemDialog" title="<?php _e('Add item', 'usces'); ?>">
1245 <div id="order-response"></div>
1246 <fieldset>
1247 <div class="clearfix">
1248 <div class="dialogsearch">
1249 <p><?php _e("Enter the item code, then press 'Obtain'", 'usces'); ?></p>
1250 <label for="name"><?php _e('item code', 'usces'); ?></label>
1251 <input type="text" name="newitemcode" id="newitemcode" class="text" />
1252 <input name="getitem" type="button" value="<?php _e('Obtain', 'usces'); ?>" onclick="if( jQuery('#newitemcode').val() == '' ) return; orderItem.getitem();" />
1253 </div>
1254 <div id="newitemform"></div>
1255 </div>
1256 </fieldset>
1257 </div>
1258
1259
1260
1261 <div id="mailSendDialog" title="">
1262 <div id="order-response"></div>
1263 <fieldset>
1264 <p><?php _e("Check the mail and click 'send'", 'usces'); ?></p>
1265 <label><?php _e('e-mail adress', 'usces'); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
1266 <label><?php _e('Client name', 'usces'); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
1267 <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 />
1268 <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
1269 <input name="mailChecked" id="mailChecked" type="hidden" />
1270 </fieldset>
1271 </div>
1272
1273 <div id="mailSendAlert" title="">
1274 <div id="order-response"></div>
1275 <fieldset>
1276 </fieldset>
1277 </div>
1278 <input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
1279 </form>
1280
1281 <div id="PDFDialog" title="">
1282 <div id="pdf_response"></div>
1283 <fieldset>
1284 <div id="new_pdf"></div>
1285 </fieldset>
1286 </div>
1287
1288 </div><!--usces_admin-->
1289 </div><!--wrap-->
1290