chengkun
2025-04-30 6ab292fb7415be124651e312ec4f21c594568f17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
 
class invoice_controller extends company
{
    function index_action(){
        include(CONFIG_PATH."db.data.php");
        $this    ->    yunset("arr_data",$arr_data);
        $this    ->    public_action();
        $this    ->    company_satic();
        $urlarr    =    array("c"=>"invoice","page"=>"{{page}}");
        $pageurl=    Url('member',$urlarr);
        $where['uid']        =    $this    ->    uid;
        $where['orderby']    =    'addtime,desc';
 
        $pageM        =    $this  -> MODEL('page');
        $pages        =    $pageM -> pageList('invoice_record',$where,$pageurl,$_GET['page']);
 
        if($pages['total'] > 0){
            $invoiceM            =    $this  -> MODEL('invoice');
            $where['limit']        =    $pages['limit'];
            $rows                =    $invoiceM    ->    getRecordList($where,array('utype'=>'member'));
            $this    ->    yunset("rows",$rows);
        }
 
        $this    ->    com_tpl('invoice');
    }
    //发票索取列表页
    function apply_action(){
        
         include(CONFIG_PATH."db.data.php");
        $this    ->    yunset("arr_data",$arr_data);
        $this    ->    public_action();
        $urlarr    =    array("c"=>"invoice","act"=>"apply","page"=>"{{page}}");
        $pageurl=    Url('member',$urlarr);
        $where    =    array(
            'uid'            =>    $this    ->    uid,
            'usertype'        =>    $this    ->    usertype,
            'order_state'    =>    2,
            'is_invoice'    =>    '0',
        );
        if($this->config['sy_com_invoice_money']){
            $where['order_price']    =    array('>=',$this->config['sy_com_invoice_money']);
        }else{
            $where['order_price']    =    array('>',0);
        }
        $where['orderby']        =    'order_time,desc';
        $invoiceM    =    $this  -> MODEL('invoice');
        $pageM        =    $this  -> MODEL('page');
        $pages        =    $pageM -> pageList('company_order',$where,$pageurl,$_GET['page']);
 
        if($pages['total'] > 0){
            $orderM                =    $this  -> MODEL('companyorder');
            $where['limit']        =    $pages['limit'];
            $rows                =    $orderM    ->    getList($where,array('invoice'=>1));
            $this    ->    yunset("rows",$rows);
        }
 
        $invoice    =    $invoiceM    ->    getInvoiceInfo(array('uid'=>$this->uid));
        $this        ->    yunset("invoice",$invoice);
        
        if($_POST['submit']){
            $orderIds                =    @explode(',',$_POST['order_id']);
            $orderIds                 =     pylode(',',$orderIds);
            $value['order_id']        =    $orderIds;
            
            $value['price']            =    $_POST['order_price'];
            $value['uid']            =    $this->uid;
            $value['did']            =    $this->userdid;
            
            $value['title']            =    trim($invoice['invoicetitle']);
            $value['type']            =    trim($invoice['invoicetype']);
            $value['invoice_id']    =    trim($invoice['registerno']);
            
            $value['bankno']        =    trim($invoice['bankno']);
            $value['bank']            =    trim($invoice['bank']);
            $value['opaddress']        =    trim($invoice['opaddress']);
            $value['opphone']        =    trim($invoice['opphone']);
            
            $value['style']            =    trim($invoice['invoicestyle']);
            
            $value['link_man']        =    trim($invoice['linkman']);
            $value['link_moblie']    =    trim($invoice['phone']);
            $value['address']        =    trim($invoice['street']);
            $value['email']            =    trim($invoice['email']);
            $value['status']        =    '0';
            $value['addtime']        =    time();
            $return    =    $invoiceM    ->    addRecord($value,array('uid'=>$this->uid));
            
            $this    ->    ACT_layer_msg($return['msg'],$return['cod'],$_SERVER['HTTP_REFERER']);
        }
        
        
        $this    ->    com_tpl('invoice_sq');
    }
    //查看/保存发票信息
    function info_action(){
        $this        ->    public_action();
        $invoiceM    =    $this    ->    MODEL('invoice');
        if($_POST['submit']){
            $id            =    intval($_POST['id']);
            
            $_POST        =    $this    ->    post_trim($_POST);
            $whereData    =    array();
             $addData    =    array(
                 'uid'            =>    $this    ->    uid,
                 'invoicetitle'    =>    $_POST['invoicetitle'],
                 'invoicetype'    =>    $_POST['invoicetype'],
                 'registerno'    =>    $_POST['registerno'],
                 'bank'            =>    $_POST['bank'],
                 'bankno'        =>    $_POST['bankno'],
                 'opaddress'        =>    $_POST['opaddress'],
                 'opphone'        =>    $_POST['opphone'],
                 'invoicestyle'    =>    $_POST['invoicestyle'],
                 'linkman'        =>    $_POST['linkman']
             );
            if($_POST['invoicestyle']=='1'){
                $addData['street']    =    $_POST['street'];
                $addData['phone']    =    $_POST['phone'];
                
            }else if($_POST['invoicestyle']=='2'){
                $addData['email']    =    $_POST['email'];
            }
            if($id){
                $whereData['id']    =    $id;
                $whereData['uid']    =    $this    ->    uid;
            }
            $return        =    $invoiceM    ->    addInvoiceInfo($whereData,$addData);
 
            $this        ->    ACT_layer_msg($return['msg'],$return['cod'],$return['url']);
        }
        $row    =    $invoiceM    ->    getInvoiceInfo(array('uid'=>$this->uid));
        $this    ->    yunset("row",$row);
        $this    ->    com_tpl('invoice_info');
    }
}
?>