コード例 #1
0
ファイル: Association.php プロジェクト: xepan/marketing
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\marketing\\MarketingCategory', 'marketing_category_id');
     $this->hasOne('xepan\\marketing\\Campaign', 'campaign_id');
     //$this->addCondition('type','CampaignCategory');
 }
コード例 #2
0
ファイル: Group.php プロジェクト: xepan/accounts
 function load($id_name)
 {
     if (is_numeric($id_name)) {
         return parent::load($id_name);
     }
     $this->unload();
     $this->tryLoadBy('name', $id_name);
     if ($this->loaded()) {
         return $this;
     }
     foreach ($this->defaultGroups as $group) {
         if ($group['name'] == $id_name) {
             // balancesheet id set and parent id set if in array
             if ($group['parent_group']) {
                 $group['parent_group_id'] = $this->newInstance()->load($group['parent_group'])->get('id');
             }
             if ($group['root_group']) {
                 $group['root_group_id'] = $this->newInstance()->load($group['root_group'])->get('id');
             }
             $group['balance_sheet_id'] = $this->add('xepan\\accounts\\Model_BalanceSheet')->load($group['balance_sheet'])->get('id');
             $this->set($group)->save();
             return $this;
         }
     }
     throw $this->exception('Could Not Load Group');
 }
コード例 #3
0
ファイル: Comments.php プロジェクト: xepan/crm
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Contact', 'created_by_id')->defaultValue($this->app->employee->id);
     $this->hasOne('xepan\\communication\\Communication_Abstract_Email', 'communication_id');
     $this->hasOne('xepan\\crm\\SupportTicket', 'ticket_id');
     $this->addField('title');
     $this->addField('description')->type('text');
     $this->addField('type');
     $this->addField('created_at')->type('datetime')->defaultValue($this->app->now);
     $this->add('misc/Field_Callback', 'callback_date')->set(function ($m) {
         if (date('Y-m-d', strtotime($m['created_at'])) == date('Y-m-d', strtotime($this->app->now))) {
             return date('h:i a', strtotime($m['created_at']));
         }
         return date('M d', strtotime($m['created_at']));
     });
     $this->addExpression('collapse_header')->set(function ($m, $q) {
         return $q->expr("IF([0] is null or [0]='',[1],[2])", [$m->getElement('description'), $m->refSQL('communication_id')->fieldQuery('description'), $m->getElement('description')]);
     });
     $this->addExpression('from')->set(function ($m, $q) {
         return $m->refSQL('communication_id')->fieldQuery('from');
     });
     $this->addExpression('image')->set(function ($m, $q) {
         return $m->add('xepan\\base\\Model_Contact')->addCondition('id', $m->refSQL('communication_id')->fieldQuery('from_id'))->fieldQuery('image');
     });
     $this->addExpression('attach_count')->set(function ($m, $q) {
         return $m->refSQL('communication_id')->fieldQuery('attachment_count');
     });
 }
コード例 #4
0
ファイル: DetailAttachment.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Contact', 'contact_id');
     $this->hasOne('xepan\\commerce\\QSP_Detail', 'qsp_detail_id');
     $this->add('xepan\\filestore\\Field_File', 'file_id');
 }
コード例 #5
0
ファイル: Association.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\commerce\\Item_CustomField_Generic', 'customfield_generic_id')->sortable(true);
     //->display(array('form'=>'autocomplete/Plus'));
     $this->hasOne('xepan\\commerce\\Item', 'item_id');
     $this->hasOne('xepan\\hr\\Department', 'department_id')->mandatory(true)->defaultValue(null)->sortable(true);
     $this->addField('status')->enum(['Active', 'DeActivate'])->defaultValue('Active')->sortable(true);
     $this->addField('group');
     $this->addField('order')->defaultValue(0)->sortable(true);
     $this->addField('can_effect_stock')->type('boolean')->defaultValue(false);
     $this->addField('is_optional')->type('boolean')->defaultValue(false);
     $this->hasMany('xepan\\commerce\\Item_CustomField_Value', 'customfield_association_id');
     $this->addExpression('name')->set(function ($m, $q) {
         return $m->refSQL('customfield_generic_id')->fieldQuery('name');
     })->sortable(true);
     $this->addExpression('display_type')->set(function ($m, $q) {
         return $m->refSQL('customfield_generic_id')->fieldQuery('display_type');
     });
     $this->addExpression('type')->set("'CustomFieldAssociation'");
     $this->addExpression('CustomFieldType')->set($this->refSQL('customfield_generic_id')->fieldQuery('type'));
     $this->addExpression('is_filterable')->set($this->refSQL('customfield_generic_id')->fieldQuery('is_filterable'));
     $this->addExpression('is_system')->set($this->refSQL('customfield_generic_id')->fieldQuery('is_system'));
     $this->addHook('beforeDelete', $this);
     $this->addHook('beforeSave', $this);
     $this->is(['customfield_generic_id|required', 'item_id|required']);
 }
コード例 #6
0
ファイル: PublishSchedule.php プロジェクト: xepan/blog
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\blog\\BlogPost');
     $this->addField('date')->display(['form' => 'DateTimePicker'])->type('datetime');
     $this->addField('is_posted')->defaultValue(0);
 }
コード例 #7
0
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\commerce\\QSP_Detail', 'qsp_detail_id');
     $this->hasOne('xepan\\hr\\Department', 'department_id');
     $this->addExpression('Quantity')->set(function ($m, $q) {
         return $m->refSQL('qsp_detail_id')->fieldQuery('quantity');
     });
     $this->addField('status')->defaultValue('Waiting');
     $this->addField('is_open')->type('boolean')->defaultValue(true)->system(true);
     // status of previous department jobcard .. if any or null
     $this->addExpression('production_level')->set(function ($m, $q) {
         return $m->refSQL('department_id')->fieldQuery('production_level');
     });
     $this->addExpression('order_no')->set($this->refSQL('qsp_detail_id')->fieldQuery('qsp_master_id'));
     $this->addExpression('qsp_order_contact')->set($this->refSQL('qsp_detail_id')->fieldQuery('order_contact'));
     // $this->addExpression('previous_status')->set(function($m,$q){
     // 	return "'Todo'";
     // 	// my departments
     // 	// my previous departments : leftJOin
     // 	// job cards of my same orderitem_id from previous departments
     // 	// limit 1
     // 	//
     // 	return $m->refSQL('xProduction/JobCard')->_dsql()->limit(1)->del('fields')->field('status');
     // });
     // hasMany JobCards
     $this->hasMany('xepan\\production\\Jobcard', 'order_item_departmental_status_id');
     $this->addHook('beforeDelete', [$this, 'deleteJobcard']);
 }
コード例 #8
0
ファイル: Epan.php プロジェクト: xepan/base
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Epan_Category');
     $this->hasOne('xepan\\base\\Contact', 'created_by_id');
     $this->addField('name')->hint('Identification for your epan');
     $this->addField('type')->defaultValue('Epan')->system(true);
     $this->addField('status')->defaultValue('Trial');
     $this->addField('created_at')->type('datetime')->defaultValue(isset($this->app->now) ? $this->app->now : null)->system(true);
     $this->addField('is_published')->defaultValue(null);
     $this->addField('extra_info')->type('text');
     $this->addField('aliases')->type('text');
     $this->addField('xepan_template_id');
     $this->addField('epan_dbversion');
     $this->hasMany('xepan\\base\\Epan_InstalledApplication', null, null, 'InstalledApplications');
     $this->hasMany('xepan\\communication\\Communication_EmailSetting', null, null, 'EmailSettings');
     $this->hasMany('xepan\\base\\Contact');
     $this->hasMany('xepan\\base\\User', null, null, 'Users');
     $this->hasMany('xepan\\base\\Epan_Configuration', null, null, 'Configurations');
     // $this->addHook('beforeDelete',[$this,'deleteAllEmailSettings']);
     // $this->addHook('beforeDelete',[$this,'deleteInstallApplications']);
     // $this->addHook('beforeDelete',[$this,'deleteContacts']);
     // $this->addHook('beforeDelete',[$this,'deleteUsers']);
     $this->is(['epan_category_id|required', 'name|required|to_trim|unique']);
 }
コード例 #9
0
ファイル: DiscountVoucher.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     // $this->hasOne('xepan\base\Epan','epan_id');
     // $this->addCondition('epan_id',$this->app->epan->id);
     $this->hasOne('xepan\\base\\Contact', 'created_by_id')->defaultValue($this->app->employee->id)->system(true);
     $this->hasOne('xepan\\base\\Contact', 'updated_by_id')->defaultValue($this->app->employee->id)->system(true);
     $this->hasOne('xepan\\commerce\\Category', 'on_category_id');
     $this->addField('name')->caption('Voucher Number');
     $this->addField('start_date')->caption('Starting Date')->type('date')->defaultValue(date('Y-m-d'))->mandatory(true);
     $this->addField('expire_date')->type('date');
     $this->addField('no_of_person')->type('Number')->defaultValue(1)->hint('How many person ? (i.e. customer for online purchasing)');
     $this->addField('one_user_how_many_time')->type('Number')->defaultValue(1)->hint('How many time it can be used by one customer during online purchasing ?');
     $this->addField('on')->setValueList(['price' => "Price", 'shipping' => "Shipping", 'gross' => 'Gross (Both)'])->defaultValue('price');
     $this->addField('include_sub_category')->type('boolean');
     $this->addField('based_on')->setValueList(['gross_amount' => "Gross Amount"]);
     $this->addField('created_at')->type('date')->defaultValue($this->app->now)->sortable(true)->system(true);
     $this->addField('updated_at')->type('date')->defaultValue($this->app->now)->sortable(true)->system(true);
     $this->hasMany('xepan/commerce/DiscountVoucherCondition', 'discountvoucher_id');
     $this->hasMany('xepan/commerce/DiscountVoucherUsed', 'discountvoucher_id');
     $this->addField('type');
     $this->addField('status')->enum(['Active', 'DeActive'])->defaultValue('Active');
     $this->addCondition('type', 'Discount_Voucher');
     $this->is(['name|to_trim|required|unique_in_epan', 'start_date|required', 'expire_date|required', 'no_of_person|number|>0', 'one_user_how_many_time|number|>0', 'on|required']);
     $this->addHook('beforeDelete', $this);
 }
コード例 #10
0
ファイル: Attandance.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Employee', 'employee_id');
     $this->addField('from_date')->type('datetime');
     $this->addField('to_date')->type('datetime')->defaultValue(null);
     $this->addExpression('fdate')->set('DATE(from_date)');
     $this->addExpression('tdate')->set('DATE(to_date)');
     $this->addExpression('official_day_start')->set(function ($m, $q) {
         return $q->expr('CONCAT([0]," ",[1])', [$m->getElement('fdate'), $m->refSQL('employee_id')->fieldQuery('in_time')]);
     });
     $this->addExpression('official_day_end')->set(function ($m, $q) {
         return $q->expr('CONCAT([0]," ",[1])', [$m->getElement('fdate'), $m->refSQL('employee_id')->fieldQuery('out_time')]);
     });
     $this->addExpression('actual_day_ending')->set(function ($m, $q) {
         return $q->expr('IFNULL([0],[1])', [$q->getField('to_date'), $m->getElement('official_day_end')]);
     });
     $this->addExpression('actual_day_start_time')->set('date_format(from_date,"%H:%i:%s")');
     $this->addExpression('actual_day_end_time')->set(function ($m, $q) {
         return $q->expr('date_format([0],"%H:%i:%s")', [$m->getElement('actual_day_ending')]);
     });
     $this->addExpression('late_coming')->set(function ($m, $q) {
         return $q->expr('TIMESTAMPDIFF(MINUTE,[0],[1])', [$m->getElement('official_day_start'), $q->getField('from_date')]);
     });
     $this->addExpression('extra_work')->set(function ($m, $q) {
         return $q->expr('TIMESTAMPDIFF(MINUTE,[0],[1])', [$m->getElement('actual_day_ending'), $m->getElement('official_day_end')]);
     });
     $this->addExpression('working_hours')->set(function ($m, $q) {
         return $q->expr('TIMESTAMPDIFF(HOUR,[0],[1])', [$q->getField('from_date'), $m->getElement('actual_day_ending')]);
     });
 }
コード例 #11
0
ファイル: Set.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\commerce\\Item', 'item_id');
     $this->addField('name');
     //->sortable(true); // To give special name to a quantity Set .. leave empty to have qty value here too
     $this->addField('qty')->type('number')->mandatory(true);
     //->sortable(true);
     $this->addField('old_price')->type('money')->mandatory(true)->caption('Unit Old Price');
     //->sortable(true);
     $this->addField('price')->type('money')->mandatory(true)->caption('Unit Price');
     //->sortable(true);
     $this->addField('is_default')->type('boolean')->defaultValue(false);
     $this->hasMany('xepan\\commerce\\Item\\Quantity\\Condition', 'quantity_set_id');
     $this->addExpression('custom_fields_conditioned')->set(function ($m, $q) {
         $temp = $m->add('xepan\\commerce\\Model_Item_Quantity_Condition')->addCondition('quantity_set_id', $q->getField('id'));
         return $temp->_dsql()->group('quantity_set_id')->del('fields')->field('count(*)');
     });
     //->sortable(true);
     $this->addExpression('conditions')->set(function ($m, $q) {
         $x = $m->add('xepan\\commerce\\Model_Item_Quantity_Condition', ['table_alias' => 'qtycondition_str']);
         return $x->addCondition('quantity_set_id', $q->getField('id'))->_dsql()->del('fields')->field($q->expr('group_concat([0] SEPARATOR "<br/>")', [$x->getElement('customfield_value')]));
     })->allowHTML(true);
     $this->addExpression('type')->set("'QuantitySet'");
     $this->addHook('beforeSave', $this);
     $this->addHook('beforeDelete', $this);
 }
コード例 #12
0
ファイル: OfficialHolidays.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('date')->type('datetime');
     $this->addField('narration')->type('text');
 }
コード例 #13
0
ファイル: Value.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\commerce\\Item_CustomField_Association', 'customfield_association_id');
     $this->addField('name');
     $this->addField('status')->enum(['Active', 'DeActive'])->defaultValue('Active');
     $this->addField('highlight_it')->type('boolean')->defaultValue(false);
     $this->addExpression('field_name_with_value')->set(function ($m, $q) {
         return $q->expr('CONCAT_WS(" :: ",[0],[1])', [$m->refSQL('customfield_association_id')->fieldQuery('customfield_generic'), $m->getElement('name')]);
     });
     $this->addExpression('customfield_name')->set(function ($m, $q) {
         return $m->refSQL('customfield_association_id')->fieldQuery('name');
     });
     $this->addExpression('customfield_type')->set(function ($m, $q) {
         return $m->refSQL('customfield_association_id')->fieldQuery('CustomFieldType');
     });
     $this->addExpression('item_id')->set($this->refSQL('customfield_association_id')->fieldQuery('item_id'));
     $this->hasMany('xepan\\commerce\\Item_Image', 'customfield_value_id');
     $this->hasMany('xepan\\commerce\\Item_Quantity_Condition', 'customfield_value_id');
     $this->hasMany('xepan\\commerce\\Store_TransactionRowCustomFieldValue', 'customfield_value_id');
     // $this->hasMany('xShop/CustomFieldValueFilterAssociation','customefieldvalue_id');
     $this->addExpression('type')->set("'CustomFieldValue'");
     $this->addHook('beforeDelete', $this);
     $this->addHook('beforeSave', $this);
     $this->is(['name|required', 'status|required']);
 }
コード例 #14
0
ファイル: FreelancerCategory.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('status')->enum(['Active', 'Inactive']);
     $this->hasMany('xepan/commerce/FreelancerCatAndCustomerAssociation', 'freelancer_category_id');
 }
コード例 #15
0
ファイル: Configuration.php プロジェクト: xepan/base
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Epan');
     $this->addField('head');
     $this->addField('value')->type('text')->display(['form' => 'xepan\\base\\RichText']);
     $this->addField('application');
 }
コード例 #16
0
ファイル: Association.php プロジェクト: xepan/marketing
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\marketing\\Lead', 'lead_id');
     $this->hasOne('xepan\\marketing\\MarketingCategory', 'marketing_category_id');
     $this->addField('created_at')->type('datetime')->defaultValue($this->app->now);
     // $this->addExpression('name')->set("'hello'");
 }
コード例 #17
0
ファイル: Attachment.php プロジェクト: xepan/base
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Document', 'document_id');
     $this->add('xepan\\filestore\\Field_File', 'file_id');
     $this->addHook('beforeDelete', $this);
     $this->is(['file_id|required']);
 }
コード例 #18
0
ファイル: Salary.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Employee', 'employee_id');
     $this->hasOne('xepan\\hr\\Salary', 'salary_id');
     $this->addField('amount')->type('int');
     $this->addField('unit')->enum(['monthly']);
 }
コード例 #19
0
ファイル: Qualification.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Employee', 'employee_id');
     $this->addField('name')->caption('Qualification')->hint('Name of Degree/Course');
     $this->addField('qualificaton_level')->hint('Graduation/Master/Phd/Others');
     $this->addField('remarks')->type('text');
 }
コード例 #20
0
ファイル: Category.php プロジェクト: xepan/base
 function init()
 {
     parent::init();
     $this->addField('name')->mandatory(true)->hint('Identification for Category');
     $this->hasMany('Epan');
     $this->is(['name|unique|to_trim|required']);
     $this->addHook('beforeDelete', $this);
 }
コード例 #21
0
ファイル: ReimbursementDetail.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Reimbursement', 'reimbursement_id');
     $this->addField('name');
     $this->addField('amount')->type('money');
     $this->addField('date')->type('date');
     $this->addField('narration')->type('text');
 }
コード例 #22
0
 function init()
 {
     parent::init();
     $this->hasOne('xepan/commerce/Item', 'item_id');
     $this->hasOne('xepan/commerce/Category', 'category_id');
     $this->addExpression('type')->set("'CategoryItemAssociation'");
     $this->addExpression('is_template')->set($this->refSql('item_id')->fieldQuery('is_template'));
     $this->addExpression('sale_price')->set($this->refSql('item_id')->fieldQuery('sale_price'));
 }
コード例 #23
0
ファイル: Association.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Post', 'post_id');
     $this->hasOne('xepan\\communication\\Communication_EmailSetting', 'emailsetting_id');
     $this->addExpression('name')->set(function ($m, $q) {
         return $m->refSQL('emailsetting_id')->fieldQuery('name');
     });
 }
コード例 #24
0
ファイル: CMSEditor.php プロジェクト: xepan/cms
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\User');
     $this->addExpression('username')->set($this->refSQL('user_id')->fieldQuery('username'));
     $this->addExpression('password')->set($this->refSQL('user_id')->fieldQuery('password'));
     $this->addField('can_edit_template')->type('boolean')->defaultValue(true);
     $this->addField('can_edit_page_content')->type('boolean')->defaultValue(true);
 }
コード例 #25
0
ファイル: OfficialHoliday.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\hr\\Employee', 'created_by_id')->defaultValue($this->app->employee->id);
     $this->addField('name');
     $this->addField('from_date')->type('date');
     $this->addField('to_date')->type('date');
     $this->addField('type')->setValueList(['official' => 'Official', 'government' => "Government", 'national' => "National", 'international' => "International", 'other' => "Other"]);
 }
コード例 #26
0
ファイル: Detail.php プロジェクト: xepan/commerce
    function init()
    {
        parent::init();
        $this->hasOne('xepan\\commerce\\QSP_Master', 'qsp_master_id');
        $this->hasOne('xepan\\commerce\\Item', 'item_id')->display(array('form' => 'xepan\\commerce\\Item'));
        $this->hasOne('xepan\\commerce\\Taxation', 'taxation_id');
        $this->hasOne('xepan\\commerce\\Model_Item_Template_Design', 'item_template_design_id');
        $this->addField('price')->caption('Rate')->type('money');
        $this->addField('quantity')->defaultValue(1);
        // $this->addField('sale_amount'); // not included tax always
        // $this->addField('original_amount'); //not included tax always
        $this->addField('shipping_charge');
        // not included tax always
        $this->addField('shipping_duration');
        $this->addField('express_shipping_charge');
        //not included tax always
        $this->addField('express_shipping_duration');
        $this->addField('tax_percentage')->defaultvalue(0)->type('money');
        $this->addExpression('is_shipping_inclusive_tax')->set($this->refSQL('qsp_master_id')->fieldQuery('is_shipping_inclusive_tax'))->type('boolean');
        $this->addExpression('qty_unit')->set($this->refSQL('item_id')->fieldQuery('qty_unit'));
        $this->addExpression('amount_excluding_tax')->set($this->dsql()->expr('
					round((([price]*[quantity])+[shipping_charges]),2)', ["price" => $this->getElement('price'), "quantity" => $this->getElement('quantity'), "shipping_charges" => $this->getElement("shipping_charge")]))->type('money');
        // $this->addField('discount')->type('money')->defaultValue(0) ;// if reversed due to tax on discounted or direct
        // effective amount = -discount(if tax on discounted) + shipping (if shipping taxable)
        $this->addExpression('tax_amount')->set($this->dsql()->expr('
				round((([price]*[quantity]+IF([is_shipping_inclusive_tax],[shipping_charges],0))*[tax_percentage]/100.00),2)', ["price" => $this->getElement('price'), "quantity" => $this->getElement('quantity'), "is_shipping_inclusive_tax" => $this->getElement('is_shipping_inclusive_tax'), "shipping_charges" => $this->getElement("shipping_charge"), "amount_excluding_tax" => $this->getElement('amount_excluding_tax'), "tax_percentage" => $this->getElement('tax_percentage')]))->type('money');
        $this->addExpression('item_designer_id')->set(function ($m, $q) {
            return $m->refSQL('item_id')->fieldQuery('designer_id');
        });
        // total_amount = effective_amount+tax+discount(if not tax on discounted) + shipping (if shipping not taxable)
        $this->addExpression('total_amount')->set(function ($m, $q) {
            return $q->expr('([0]+[1])', [$m->getElement('amount_excluding_tax'), $m->getElement('tax_amount')]);
        })->type('money');
        $this->addField('narration')->type('text')->display(['form' => 'xepan\\base\\RichText'])->defaultValue(null);
        $this->addField('extra_info')->type('text')->defaultvalue('{}');
        // Custom Fields
        $this->addExpression('customer_id')->set($this->refSQL('qsp_master_id')->fieldQuery('contact_id'));
        $this->addExpression('customer')->set($this->refSQL('qsp_master_id')->fieldQuery('contact'));
        $this->addExpression('name')->set(function ($m, $q) {
            return $m->refSQL('item_id')->fieldQuery('name');
        });
        $this->addExpression('qsp_status')->set($this->refSQL('qsp_master_id')->fieldQuery('status'));
        $this->addExpression('qsp_type')->set($this->refSQL('qsp_master_id')->fieldQuery('type'));
        $this->addExpression('sub_tax')->set($this->refSQL('taxation_id')->fieldQuery('sub_tax'));
        $this->addExpression('received_qty')->set(function ($m, $q) {
            // return $q->getField('id');
            return $m->add('xepan\\commerce\\Model_Store_TransactionRow')->addCondition('qsp_detail_id', $m->getElement('id'))->sum('quantity');
        })->type('int');
        $this->is(['price|to_trim|required', 'quantity|gt|0']);
        $this->addHook('beforeSave', $this);
        $this->addHook('afterInsert', $this);
        $this->addHook('afterSave', $this);
        $this->addHook('beforeDelete', $this);
        $this->addHook('afterDelete', $this);
        $this->hasMany("xepan\\commerce\\QSP_DetailAttachment", 'qsp_detail_id', null, 'Attachments');
        $this->hasMany("xepan\\commerce\\Store_TransactionRow", 'qsp_detail_id', null, 'StoreTransactionRows');
    }
コード例 #27
0
ファイル: Consumption.php プロジェクト: xepan/commerce
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\commerce\\Item_Department_Association', 'item_department_association_id');
     $this->hasOne('xepan\\commerce\\Item', 'composition_item_id');
     $this->addField('quantity');
     $this->addField('unit');
     $this->addField('custom_fields')->type('text');
 }
コード例 #28
0
ファイル: Application.php プロジェクト: xepan/base
 function init()
 {
     parent::init();
     $this->addField('name')->mandatory(true)->hint('Identification of xEpan Application');
     $this->addField('namespace')->mandatory(true)->hint('Identification of xEpan Application');
     $this->addField('user_installable')->type('boolean')->defaultValue(true);
     $this->addField('default_currency_price')->type('money');
     $this->hasMany('xepan\\base\\Epan_InstalledApplication', null, null, 'Installations');
     $this->is(['name|unique|to_trim|required']);
 }
コード例 #29
0
ファイル: Salary.php プロジェクト: xepan/hr
 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('type')->enum(['Salary', 'Allowance', 'Deduction']);
     $this->addField('add_deducat')->enum(['add', 'dedcation']);
     $this->addField('unit')->enum(['Month', 'Leave']);
     $this->hasMany('xepan\\hr\\SalaryTemplateDetails', 'salary_id');
     $this->hasMany('xepan\\hr\\Employee_Salary', 'salary_id');
 }
コード例 #30
0
ファイル: TransactionType.php プロジェクト: xepan/accounts
 function init()
 {
     parent::init();
     $this->hasOne('xepan\\base\\Epan', 'epan_id');
     $this->addField('name');
     $this->addField('FromAC');
     $this->addField('ToAC');
     $this->addField('Default_Narration');
     $this->hasMany('xepan\\accounts\\Transaction', 'transaction_type_id');
 }