<?php
class Service_BilCustomerBill extends Common_Service
{
    /**
     * @var null
     */
    public static $_modelClass = null;

    /**
     * @return Table_BilCustomerBill|null
     */
    public static function getModelInstance()
    {
        if (is_null(self::$_modelClass)) {
            self::$_modelClass = new Table_BilCustomerBill();
        }
        return self::$_modelClass;
    }

    /**
     * @param $row
     * @return mixed
     */
    public static function add($row)
    {
        $model = self::getModelInstance();
        return $model->add($row);
    }


    /**
     * @param $row
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function update($row, $value, $field = "bcb_id")
    {
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function delete($value, $field = "bcb_id")
    {
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @param string $colums
     * @return mixed
     */
    public static function getByField($value, $field = 'bcb_id', $colums = "*")
    {
        $model = self::getModelInstance();
        return $model->getByField($value, $field, $colums);
    }

    /**
     * @return mixed
     */
    public static function getAll()
    {
        $model = self::getModelInstance();
        return $model->getAll();
    }

    /**
     * @param array $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function getByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getByCondition($condition, $type, $pageSize, $page, $order);
    }

    public static function getJoinLeftByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getJoinLeftByCondition($condition, $type, $pageSize, $page, $order);
    }

    /**
     * @param $val
     * @return array
     */
    public static function validator($val)
    {
        $validateArr = $error = array();
        
        return  Common_Validator::formValidator($validateArr);
    }


    /**
     * @param array $params
     * @return array
     */
    public  function getFields()
    {
        $row = array(
        
              'E0'=>'bcb_id',
              'E1'=>'customer_code',
              'E2'=>'bcb_status',
              'E3'=>'bcb_code',
              'E4'=>'bcb_reference_no',
              'E5'=>'bcb_amount',
              'E6'=>'bcb_bill_date',
              'E7'=>'bcb_writeoff_sign',
              'E8'=>'sm_code',
              'E9'=>'bcb_downloads',
              'E10'=>'bcb_note',
              'E11'=>'bcb_creator_id',
              'E12'=>'bcb_create_type',
              'E13'=>'bcb_invoice_sign',
              'E14'=>'bcb_invoice_amount',
              'E15'=>'bcb_add_time',
              'E16'=>'bcb_review_sign',
              'E17'=>'bcb_delete_id',
              'E18'=>'bcb_confirm_id',
              'E19'=>'bcb_verifier_id',
              'E20'=>'bcb_delete_time',
              'E21'=>'bcb_confirm_time',
              'E22'=>'bcb_verify_time',
              'E23'=>'bcb_update_time',
              'E24'=>'currency_code',
              'E25'=>'ds_code',
              'E26'=>'writeoff_amount',
              'E27'=>'bcb_bill_start_date',

        );
        return $row;
    }

}