<?php

return array
(
    # 表名
    'name' => 'area_entry',
    # 显示给用户看的名称
    'lang' => '区域分润录入',
    'order' => 79,
    'menu' => 'agent',
    'end' => array
    (
        //'insert' => 'mail/lib/manage.updateArea_entry', 
    ),
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            //'list'        => true,
        ),

        'month'     => array
        (
            'type'      => 'int-11',
            'name'      => '月份',
            'default'   => '',
            'match'     => 'is_numeric',
            'desc'      => '',
            'update'    => 'month',
            'search'    => 'month_eq',
            'callback'  => 'maketime',
            'list'      => 'date("Y-m", {month})',
        ),

        'shop_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '店铺名称/店铺编号',
            'default'   => '',
            'desc'      => '店铺名称',
            'match'     => 'is_numeric',
            'update'    => 'select',
            'update_search' => 'shop/lib/manage.search_l_shop',
            'search'    => array
            (
                'api' => 'shop/info-like',
                'col' => '*',
                'result' => 'id',
            ) ,
            'list_name' => '门店信息',
            'list'      => 'Dever::load("mail/lib/manage.entry_member", {id})',
            'list_order' => 2,
        ),

        'buy'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '毛利',
            'default'   => '0',
            'desc'      => '采购金额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
            'list_order' => 4,
        ),

        'state'     => array
        (
            'type'      => 'tinyint-1',
            'name'      => '状态',
            'default'   => '1',
            'desc'      => '请选择状态',
            'match'     => 'is_numeric',
        ),
        
        'cdate'     => array
        (
            'type'      => 'int-11',
            'name'      => '统计时间',
            'match'     => array('is_numeric', time()),
            'desc'      => '',
        ),
    ),

    'manage' => array
    (
        // 'insert' => false,
        'delete' => false,
        // 'edit' => false,
        // 'excel' => true,
    ),

    'request' => array
    (
        'getBuy' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'start' => array('yes-month','>='),
                'end' => array('yes-month','<='),
                'shop_id' => array('yes','in'),
                'state' => 1,
            ),
            
            'type' => 'all',
            'col' => '*',
        ),

        'getBuyTotal' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'start' => array('yes-month','>='),
                'end' => array('yes-month','<='),
                'shop_id' => 'yes',
                'state' => 1,
            ),
            
            'type' => 'one',
            'col' => 'sum(buy) as total',
        ),
    ),
);
