City Square Mall Search Batch Update 的规则

单张voucher 做action的流程是:

1.点击detail后获取该张voucher可做的action( get_voucher_actions($voucher_details) )

function get_voucher_actions( $voucher_details )
 {
  //$this->load->model('access_control', 'vms_acl');
  
  $voucher_id = $voucher_details['voucher_id'];
  
  //we also need to check the stock of the voucher to dertimine the actions.
  //e.g. new voucher in Finance stock cannot be re-issued.
  $actions = array();
  
  //if( $this->vms_acl->is_csa_user())
  //{
   switch($voucher_details['status_id'])
   {
    case $this->voucher_lkup->get_status_id_by_name('new'):
     //the following actions are only available if the voucher is not locked.
     if( $voucher_details['is_locked'] == 'N' )
     {
      if( $voucher_details['stock_id'] != $this->voucher_lkup->get_stock_id_by_name('expiry') )
      {
       $actions[] = 'miss'; //from any stock (except for expiry stock)
      }
      
      if( $voucher_details['stock_id'] == $this->voucher_lkup->get_stock_id_by_name('csa') ) //Cancal should be done on own stock.
      {
       $actions[] = 'cancel';
      }
      
      if( $voucher_details['stock_id'] == $this->voucher_lkup->get_stock_id_by_name('cse') )
      {
       //Re-issue (via scanner or manual input) Physically the voucher was already issued
       //- For Promo, Counter sales, partner  vouchers - From CSE stock
       $actions[] = 'reissue'; //(by CSA only)
      }
      
      //change expiry date, Can only be changed if the voucher has not  expired, Tenant voucher only
      //status must be new.
      $tenant_class_ids = $this->voucher_lkup->get_voucher_class_ids( $this->voucher_api->_class_tenant );
      if( in_array($voucher_details['class_id'], $tenant_class_ids) 
        && strtotime($voucher_details['expiry_date'] . ' 23:59:59') >= strtotime( date('Y-m-d 23:59:59') ) 
       &&  $voucher_details['stock_id'] == $this->voucher_lkup->get_stock_id_by_name('csa') 
      )
      {
       //$actions[] = 'change_expiry';
      }
     }
     
     break;
    
    case $this->voucher_lkup->get_status_id_by_name('cancelled'): 
     //request reinstatement-cancelled,
     //check if someone requested un-cancelled. if so, show approve reinstatement-cancelled
     $rt = $this->voucher_api->voucher_is_pending_approve_uncancel( $voucher_id );
     if(FALSE === $rt && $voucher_details['is_locked'] == 'N')
     {
      $actions[] = 'request_uncancel';
     }
     elseif( !$this->vms_acl->is_same_login_user( $rt['request_user'] ) ) //only if the user is different 
     {
      $actions[] = 'approve_uncancel';
     }  
     break;
     
    
    case $this->voucher_lkup->get_status_id_by_name('missing'):
     //request reinstatement-missing,
     //check if someone requested un-missing. if so, show approve reinstatement-missing
     $rt = $this->voucher_api->voucher_is_pending_approve_unmissing( $voucher_id );
     if(FALSE === $rt && $voucher_details['is_locked'] == 'N')
     {
      $actions[] = 'request_unmissing';
     }
     elseif( !$this->vms_acl->is_same_login_user( $rt['request_user'] ) ) //only if the user is different 
     {
      $actions[] = 'approve_unmissing';
     }
     break;
    
    case $this->voucher_lkup->get_status_id_by_name('issued'):
     //unissue, replace, extend expiry date. (only when the expiry date of voucher set)
     
     //only when the voucher is not expired
     if( strtotime($voucher_details['expiry_date'] . ' 23:59:59') >= strtotime( date('Y-m-d 23:59:59') )  && $voucher_details['is_locked'] == 'N' )
     {
      $actions[] = 'unissue';
      $actions[] = 'replace';
     }
     //$actions[] = 'extend';

     break;
    case $this->voucher_lkup->get_status_id_by_name('reimbursed'):
     $rt = $this->voucher_api->voucher_is_pending_approve_unreimburse( $voucher_id );
     if(FALSE === $rt && $voucher_details['is_locked'] == 'N')
     {
      $actions[] = 'request_unreimburse';
     }
     elseif( !$this->vms_acl->is_same_login_user( $rt['request_user'] ) ) //only if the user is different
     {
      $actions[] = 'approve_unreimburse';
     }
     break;
     //un-reimburse
    
    default:
     break;
   }//end of switch
  //}
  
  
  if( empty($voucher_details['alert_tag']) && $this->vms_acl->is_csa_user() )
  {
   $actions[] = 'tag'; //tag will be available in any status, only csa can tag.
  }
  elseif(!empty($voucher_details['alert_tag']))
  {
   $rt = $this->voucher_api->voucher_is_pending_approve_untag( $voucher_id );
   if(FALSE === $rt && $this->vms_acl->is_csa_user())
   {
    $actions[] = 'request_untag';//un-tag will be available if there is any tags of this voucher.
   }
   elseif( !$this->vms_acl->is_same_login_user( $rt['request_user'] ) && $this->vms_acl->is_cd_user() ) //only if the user is different 
   {
    $actions[] = 'approve_untag'; //only CD can do approve
   }
  }
 
  $rt = array();
  if(!empty($actions))
  {
   foreach($actions as $action_name)
   {
    $action_id = $this->voucher_lkup->get_action_id_by_name ( $action_name );
    
    $rt[$action_name] = $this->voucher_lkup->get_action_desc_by_id ( $action_id );
   }
  }
  
  return $rt;
 }

operation 里voucher的Available Actions update操作

流程纪录:

1.delete_issue

    a.delete_campaign_issue_info //删除voucher_campaign_issue里对应voucher_id的内容

    b.delete_voucher_action          //删除voucher_action里对应voucher_id的内容

2.issue

    a.update_vouchers_data_by_voucher_id

    b.insert_voucher_action

    c.insert_campaign_issue_info

 

执行操作如下:

UPDATE voucher SET transfer_channel = 2 where voucher_id BETWEEN 467880 AND 467954
update voucher_campaign_issue set remarks = concat(remarks,'<br>Payment: Cash') where voucher_id  BETWEEN 467880 AND 467954

做GVMS Reimburesment Impor异常的处理

客户发过来的表格会把以前错误的reimburesment信息一起发过来,我们手动修改

例如这次在检查完第一步之后出现一条有问题的信息这个以前reimburesment过

------------------------------------------------

439533320OCBC 007685Pod Life Pte Ltd              2013-08-05PODLIP1  12-0145  SD 5333A            1406

------------------------------------------------

 

在voucher_store_submission里查找submission_id为5333的数据

------------------------------------------------

53332012-11-27 16:37:36240001505330'10144129','10145777','505819','505821'NNULL

------------------------------------------------

找到requisition_id为5330

然后在voucher_purchase_requisition里找到requisition_id为5330的数据

------------------------------------------------

53302012-11-27 16:37:4015043405333

------------------------------------------------

找到reimburse_id 为4340

然后在voucher_reimburse里找到reimburse_id 为4340的数据

------------------------------------------------

43402012-12-21 23:59:5910OCBC0075792012-12-21 00:00:00NULLVenderNumber:PODLIP1   BatchNumber:12-0111  InvoiceNumber:SD 5333 

------------------------------------------------

把cheque_no改为OCBC 007685 ,batch_number改为 12-0145  

evolution 1. 的operation

点击 "Release"后触发前端的investigation_button_release()方法ajax的url为http://test.com/evo/_panels_c/voucher/search_form/investigate

change_status"6-2"

status_id"6-1"

voucher_no"05-2"

 

investigate方法为:

    function investigate()

    {

        if(IS_AJAX)

     {

         $d_time = date('Y-m-d H:i:s');

         

         $voucher_no = $this->input->post('voucher_no'); // voucher No. with prefix

         $voucher_id = $this->input->post('voucher_id');

         $remarks = $this->input->post('remarks');

         $action = $this->input->post('action');

         $status_id = $this->input->post('status_id');

         $new_status = $this->input->post('change_status');

         

         $voucher_update_data = array();

         

         if($new_status != $status_id && ($status = $this->voucher_lkup->show_available_status_to_change()) && isset($status[$new_status]))

         {

             $new_description = $status[$new_status];

             $old_description = $status[$status_id];

             

             $new_channel = FALSE;

             if(strpos($new_status, '-') !== FALSE)

             {

                    $tmp = explode('-', $new_status);

                    $new_status = $tmp[0];

                    $new_channel = $tmp[1];

                    

                    $voucher_update_data['status_id'] = $new_status;

                    $voucher_update_data['transfer_channel'] = $new_channel == 'NIL' ? '' : $new_channel;

                }

                else

                {

                    $voucher_update_data['status_id'] = $new_status;

                }

                

                $action_data = array();

                $action_data['action_id'] = $this->voucher_lkup->get_action_id('change_status');

                $action_data['voucher_id'] = $voucher_id;

                $action_data['user_id'] = $this->voucher_lkup->_user_id;

                $action_data['action_time'] = $d_time;

                $action_data['comment'] = "From $old_description to $new_description";

                $this->voucher_batch->insert_voucher_action($action_data);

                

                // if status = tenant_submit and voucher existed in tenant_submit_error table, delete it from error table.

                if($status_id == $this->voucher_lkup->get_status_id('tenant_submitted'))

                {

                    $this->voucher_batch->delete_tenant_submission_error($voucher_id);

                }

         }

         

            // do investigation on $voucher_id.

            $b_investigate = true;

            

            if($action == 'release')

            {

                $action_data = array();

                $action_data['action_id'] = $this->voucher_lkup->get_action_id('release_investigation');

                $action_data['voucher_id'] = $voucher_id;

                $action_data['user_id'] = $this->voucher_lkup->_user_id;

                $action_data['action_time'] = $d_time;

                $action_data['comment'] = $remarks;

                $this->voucher_batch->insert_voucher_action($action_data);

                

                if($status_id == $this->voucher_lkup->get_status_id('tenant_submitted'))

                {

                    $errors = $this->voucher_batch->get_tenant_submission_error($voucher_id);

                    if(!empty($errors))

                    {

                        $voucher_update_data['submission_id'] = $errors['submission_id'];

                        $this->voucher_batch->delete_tenant_submission_error($voucher_id);

                        

                        //check if tenant_submit action recorded in voucher_action, if not, record it.

                        $log = $this->voucher_batch->get_voucher_action($voucher_id, $this->voucher_lkup->get_action_id('tenant_submit'));

                        if(empty($log))

                        {

                            $action_data = array();

                            $action_data['action_id'] = $this->voucher_lkup->get_action_id('tenant_submit');

                            $action_data['voucher_id'] = $voucher_id;

                            $action_data['user_id'] = $this->voucher_lkup->_user_id;

                            $action_data['action_time'] = $errors['submission_time'];

                            $this->voucher_batch->insert_voucher_action($action_data);

                        }

                    }

                }

                $voucher_update_data['under_investigation'] = 'N';

                $this->voucher_batch->update_vouchers_data_by_voucher_id($voucher_id, $voucher_update_data);

            }

            else

            {

                $voucher_update_data['under_investigation'] = 'Y';

                $this->voucher_batch->update_vouchers_data_by_voucher_id($voucher_id, $voucher_update_data);

                

                $action_data = array();

                $action_data['action_id'] = $this->voucher_lkup->get_action_id('investigate');

                $action_data['voucher_id'] = $voucher_id;

                $action_data['user_id'] = $this->voucher_lkup->_user_id;

                $action_data['action_time'] = $d_time;

                $action_data['comment'] = $remarks;

                $this->voucher_batch->insert_voucher_action($action_data);

            }

            

            $result = array();

            $result['result'] = ($b_investigate !== FALSE) ? '1' : '2';

            $result['voucher'] = $this->_search_individual($voucher_no);

            

            echo json_encode($result);

     }

    }

在investigate里做了2个操作,一个是$this->voucher_batch->insert_voucher_action($action_data);
一个是 $this->voucher_batch->update_vouchers_data_by_voucher_id($voucher_id, $voucher_update_data);

如何调节自己情绪

 

       这两天回淮南和长辈沟通了很多,特别是王刚。他们都是年长我很多的,这2天他们给我的思想就是让自己开心一点,不要总为别人所说所想去影响自己。而正是因为太在意别人的看法,别人的想法而导致我的自私与不自信。正视自己很重要。长大了就像老董说的,我们这个年级已经形成了自己的人生观价值观,不是别人说什么就认为是什么的了。

 

以下是几个网上摘抄的缓解压力的方法

1、正确评价自己,不要过高要求自己。正确认识自己、评价自己是个性发展的重要前提之一。自己对自己的认识、评价是在发展过程中逐渐培养起来的。对自己有正确的认识,做自己可以胜任的事情,对自己有个合理的预期和评价。 

2、培养独立的人格,减少他人评价的影响。认识自己的价值,明确应该坚持什么、反对什么,有明确的是非界限,且不能人云亦云,不要被周围所左右。 

3、多与人交流沟通,及时倾诉自己感受到的无助和不快。交流是释放压力的交效途径,交流的过程也是自我反思的过程。通过与他人交谈,获取心理支持,增强自信心。 

4、利用各种社会支持。任何心理成熟的独立的现代人,都需要他人的帮助,广泛的社会支持是缓解压力不可或缺的途径。家人是社会支持网络的重要组成部分。此外,平时需注意扩大自己的交际范围,从没有利益冲突的第三方寻求心理支持。 

5、从多纬度审视自己,建立自我同一性。由于自我意识具有复杂性与多维性,青年需要在多向度中审视自我、调整自我,寻找自我意识的统一点,整合自我意识,向理想自我靠近。 

 

推荐方法:

 

1 和朋友聊天,一起玩玩。

2 有一个自己的爱好,这样能分散自己的精力!

3 周末逛街,买自己喜欢的东西,衣服什么的,提高自己的自信心!

4 旅游!爬山是最好的了!

HTML表格的填充与间距

    单元格(cell) — 表格的内容

  • cellpadding) — 代表单元格外面的一个距离,用于隔开单元格与单元格空间
  • cellspacing) — 代表表格边框与单元格补白的距离,也是单元格补白之间的距离
  • 表格单元格图示
  • 上图说明了表格的几个属性,其中黑色部分就是单元格(cell),白色的区域是单元格边距(表格填充),灰色的区域是单元格间距(表格间距)。

<embed height=”0″ id=”xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd” type=”application/thunder_download_plugin” width=”0″></embed>

MYSQL 操作符优先级

今天遇到一个操作符优先级问题 所以上网搜索以做记录

--------------------------------

操作符优先级
以下列表显示了操作符优先级的由低到高的顺序。排列在同一行的操作符具有相同的优先级。

:=

||, OR, XOR

&&, AND

NOT

BETWEEN, CASE, WHEN, THEN, ELSE

=, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN

|

&

<<, >>

-, +

*, /, DIV, %, MOD

^

– (一元减号), ~ (一元比特反转)

!

BINARY, COLLATE

注释:假如 HIGH_NOT_PRECEDENCE SQL 模式被激活,则 NOT 的优先级同 the  ! 操作符相同。请参见5.3.2节,“SQL服务器模式”。

12.1.2. 圆括号
( … )

使用括弧来规定表达式的运算顺序,例如:

mysql> SELECT 1+2*3;
        -> 7
mysql> SELECT (1+2)*3;
        -> 9