<?php
/**
 * The config file of contract module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Yidong Wang <yidong@cnezsoft.com>
 * @package     contract 
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
$config->contract->beginDate   = '';    // The date begin to analysis contract report.
$config->contract->memberCount = 5;

$config->contract->require = new stdclass();
$config->contract->require->create  = 'customer, name, signType';
$config->contract->require->edit    = 'customer, name, signType';
$config->contract->require->receive = 'amount, depositor, returnedDate';

$config->contract->editor = new stdclass();
$config->contract->editor->create       = array('id' => 'items',   'tools' => 'simple');
$config->contract->editor->edit         = array('id' => 'items',   'tools' => 'simple');
$config->contract->editor->receive      = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->delivery     = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->finish       = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->cancel       = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->editreturn   = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->editdelivery = array('id' => 'comment', 'tools' => 'simple');
$config->contract->editor->view         = array('id' => 'remark,lastComment', 'tools' => 'simple');

$config->contract->receiveNoNeedFields  = 'currencyLabel,createTrade,updateTrade,continue,finish,depositor,dept,category,product,currency,exchangeRate,handlers';
$config->contract->contractNoNeedFields = 'currencyLabel,createTrade,updateTrade,continue,finish,depositor,dept,category,product,currency,exchangeRate,amount';
$config->contract->tradeNoNeedFields    = 'currencyLabel,createTrade,updateTrade,continue,finish,amount,returnedBy,returnedDate';

global $lang, $app;
$config->contract->search['module'] = 'contract';

$config->contract->search['fields']['name']          = $lang->contract->name;
$config->contract->search['fields']['code']          = $lang->contract->code;
$config->contract->search['fields']['product']       = $lang->contract->product;
$config->contract->search['fields']['amount']        = $lang->contract->amount;
$config->contract->search['fields']['scanFile']      = $lang->contract->scanFile;
$config->contract->search['fields']['inspectFile']   = $lang->contract->inspectFile;
$config->contract->search['fields']['signType']      = $lang->contract->signType;
$config->contract->search['fields']['signedBy']      = $lang->contract->signedBy;
$config->contract->search['fields']['signedDate']    = $lang->contract->signedDate;
$config->contract->search['fields']['status']        = $lang->contract->status;
$config->contract->search['fields']['begin']         = $lang->contract->begin;
$config->contract->search['fields']['end']           = $lang->contract->end;
$config->contract->search['fields']['createdBy']     = $lang->contract->createdBy;
$config->contract->search['fields']['createdDate']   = $lang->contract->createdDate;
$config->contract->search['fields']['dept']          = $lang->contract->dept;
$config->contract->search['fields']['delivery']      = $lang->contract->delivery;
$config->contract->search['fields']['deliveredBy']   = $lang->contract->deliveredBy;
$config->contract->search['fields']['deliveredDate'] = $lang->contract->deliveredDate;
$config->contract->search['fields']['return']        = $lang->contract->return;
$config->contract->search['fields']['returnedBy']    = $lang->contract->returnedBy;
$config->contract->search['fields']['returnedDate']  = $lang->contract->returnedDate;
$config->contract->search['fields']['id']            = $lang->contract->id;

$config->contract->search['params']['name']          = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->contract->search['params']['code']          = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->contract->search['params']['product']       = array('operator' => 'include', 'control' => 'select', 'values' => 'set in control');
$config->contract->search['params']['amount']        = array('operator' => '>=', 'control' => 'input',  'values' => '');
$config->contract->search['params']['scanFile']      = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->uploadStatusList);
$config->contract->search['params']['inspectFile']   = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->uploadStatusList);
$config->contract->search['params']['signType']      = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->signTypeList);
$config->contract->search['params']['signedBy']      = array('operator' => '=',  'control' => 'select', 'values' => 'users');
$config->contract->search['params']['signedDate']    = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['status']        = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->statusList);
$config->contract->search['params']['begin']         = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['end']           = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['createdBy']     = array('operator' => '=',  'control' => 'select', 'values' => 'users');
$config->contract->search['params']['createdDate']   = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['dept']          = array('operator' => '=',  'control' => 'select', 'values' => 'depts');
$config->contract->search['params']['delivery']      = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->deliveryList);
$config->contract->search['params']['deliveredBy']   = array('operator' => '=',  'control' => 'select', 'values' => 'users');
$config->contract->search['params']['deliveredDate'] = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['return']        = array('operator' => '=',  'control' => 'select', 'values' => $lang->contract->returnList);
$config->contract->search['params']['returnedBy']    = array('operator' => '=',  'control' => 'select', 'values' => 'users');
$config->contract->search['params']['returnedDate']  = array('operator' => '>=', 'control' => 'input',  'values' => '', 'class' => 'date');
$config->contract->search['params']['id']            = array('operator' => '=',  'control' => 'input',  'values' => '');

$config->contract->list = new stdclass();
$config->contract->list->exportFields = '
  id, customer, order, name, product, code, amount, currency, begin, end,
  delivery, return, status, contact, address, handlers, signType, signedBy, signedDate,
  deliveredBy, deliveredDate, returnedBy, returnedDate, finishedBy, finishedDate,
  canceledBy, canceledDate, createdBy, createdDate, editedBy, editedDate,
  contactedBy, contactedDate, nextDate, items, files';

$config->contract->moduleType = array();
$config->contract->moduleType['sale']     = 'contract';
$config->contract->moduleType['purchase'] = 'purchasecontract';

$config->contract->customerType = array();
$config->contract->customerType['sale']     = 'customer';
$config->contract->customerType['purchase'] = 'provider';

$config->contract->relationType = array();
$config->contract->relationType['sale']     = 'client';
$config->contract->relationType['purchase'] = 'provider';

$config->contract->tradeType = array();
$config->contract->tradeType['sale']     = 'in';
$config->contract->tradeType['purchase'] = 'out';

$config->contract->receiveType = array();
$config->contract->receiveType['sale']     = 'receive';
$config->contract->receiveType['purchase'] = 'pay';

$config->contract->returnType = array();
$config->contract->returnType['sale']     = 'returned';
$config->contract->returnType['purchase'] = 'paid';

$config->contract->hasParticipation = false;
