Exemple #1
0
 function init()
 {
     parent::init();
     $osp_j = $this->join('outsource_party.contact_id');
     $osp_j->hasOne('xepan\\hr\\Department', 'department_id');
     $osp_j->hasOne('xepan\\accounts\\Currency', 'currency_id');
     $osp_j->addField('bank_name');
     $osp_j->addField('pan_it_no')->caption('Pan / IT No.');
     $osp_j->addField('tin_no')->caption('TIN / CST No.');
     $osp_j->addField('account_no');
     $osp_j->addField('account_type');
     $osp_j->addField('time');
     $osp_j->addField('os_address')->type('text');
     $osp_j->addField('os_city');
     $osp_j->addField('os_state');
     $osp_j->addField('os_country');
     $osp_j->addField('os_pincode');
     $osp_j->hasMany('xepan\\production\\Jobcard', 'outsourceparty_id');
     $this->hasMany('xepan/commerce/Model_QSP_Master', null, null, 'QSPMaster');
     $this->addCondition('type', 'OutsourceParty');
     //TODO Extra Organization Specific Fields other Contacts
     $this->getElement('status')->defaultValue('Active');
     // $this->addHook('beforeSave',$this);
     $this->addHook('afterSave', $this);
     $this->addHook('beforeDelete', [$this, 'checkExistingQSPMaster']);
     $this->addHook('beforeDelete', [$this, 'checkExistingJobCard']);
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }
Exemple #2
0
 function init()
 {
     parent::init();
     $this->addCondition('type', 'Warehouse');
     $this->getElement('first_name')->caption('Name');
     $this->hasMany('xepan\\commerce\\Store_Transaction', 'from_warehouse_id', null, 'FromTransactions');
     $this->hasMany('xepan\\commerce\\Store_Transaction', 'to_warehouse_id', null, 'ToTransactions');
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }
Exemple #3
0
 function init()
 {
     parent::init();
     $this->getElement('created_by_id')->defaultValue($this->app->employee->id);
     $affiliate_j = $this->join('affiliate.contact_id');
     $affiliate_j->addField('narration')->type('text');
     $this->addCondition('type', 'Affiliate');
     $this->getElement('status')->defaultValue('Active');
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }
Exemple #4
0
 function init()
 {
     parent::init();
     $this->getElement('post')->destroy();
     $this->getElement('created_by_id')->defaultValue(@$this->app->employee->id);
     $emp_j = $this->join('employee.contact_id');
     $emp_j->hasOne('xepan\\base\\GraphicalReport', 'graphical_report_id');
     $emp_j->hasOne('xepan\\hr\\Department', 'department_id')->sortable(true)->display(array('form' => 'xepan\\commerce\\DropDown'));
     $emp_j->hasOne('xepan\\hr\\Post', 'post_id')->display(array('form' => 'xepan\\commerce\\DropDown'));
     $emp_j->addField('notified_till')->type('number')->defaultValue(0);
     // TODO Should be current id of Activity
     $emp_j->addField('offer_date')->type('date')->sortable(true);
     $emp_j->addField('doj')->caption('Date of Joining')->type('date')->defaultValue(@$this->app->now)->sortable(true);
     $emp_j->addField('contract_date')->type('date');
     $emp_j->addField('leaving_date')->type('date');
     $emp_j->addField('attandance_mode')->enum(['Web Login', 'Mannual'])->defaultValue('Web Login');
     $emp_j->addField('in_time')->display(array('form' => 'TimePicker'));
     $emp_j->addField('out_time')->display(array('form' => 'TimePicker'));
     $emp_j->hasMany('xepan\\hr\\Employee_Attandance', 'employee_id', null, 'Attendances');
     $emp_j->hasMany('xepan\\hr\\Employee_Qualification', 'employee_id', null, 'Qualifications');
     $emp_j->hasMany('xepan\\hr\\Employee_Experience', 'employee_id', null, 'Experiences');
     $emp_j->hasMany('xepan\\hr\\Employee_Document', 'employee_id', null, 'EmployeeDocuments');
     $emp_j->hasMany('xepan\\hr\\Employee_Movement', 'employee_id', null, 'EmployeeMovements');
     $emp_j->hasMany('xepan\\hr\\Employee_Salary', 'employee_id', null, 'EmployeeSalary');
     $emp_j->hasMany('xepan\\hr\\Employee_LeaveAllow', 'employee_id', null, 'EmployeeLeaveAllow');
     $this->addExpression('posts')->set(function ($m) {
         return $m->refSQL('post_id')->fieldQuery('name');
     });
     $this->addExpression('first_email')->set(function ($m, $q) {
         $x = $m->add('xepan\\base\\Model_Contact_Email');
         return $x->addCondition('contact_id', $q->getField('id'))->addCondition('is_active', true)->addCondition('is_valid', true)->setLimit(1)->fieldQuery('value');
     });
     $this->addExpression('check_login')->set(function ($m, $q) {
         $attan_m = $this->add("xepan\\hr\\Model_Employee_Attandance")->addCondition('employee_id', $m->getElement('id'))->addCondition('fdate', $this->app->today);
         return $q->expr('IFNULL([0],0)', [$attan_m->fieldQuery('id')]);
     })->type('int');
     $this->getElement('status')->defaultValue('Active');
     $this->addCondition('type', 'Employee');
     $this->addHook('afterSave', [$this, 'throwEmployeeUpdateHook']);
     $this->addHook('afterSave', [$this, 'updateTemplates']);
     $this->addHook('beforeDelete', [$this, 'deleteQualification']);
     $this->addHook('beforeDelete', [$this, 'deleteExperience']);
     $this->addHook('beforeDelete', [$this, 'deleteEmployeeDocument']);
     $this->addHook('beforeDelete', [$this, 'deleteEmployeeLedger']);
     $this->addHook('beforeDelete', [$this, 'deleteEmployeeMovements']);
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
     $this->addHook('beforeSave', [$this, 'updateEmployeeSalary']);
     $this->addHook('beforeSave', [$this, 'updateEmployeeLeave']);
 }
Exemple #5
0
 function init()
 {
     parent::init();
     $this->getElement('created_by_id')->defaultValue($this->app->employee->id);
     $supl_j = $this->join('supplier.contact_id');
     $supl_j->hasOne('xepan\\accounts\\Currency', 'currency_id');
     //TODO Other Contacts
     $supl_j->addField('tin_no');
     $supl_j->addField('pan_no');
     $this->hasMany('xepan/commerce/Model_QSP_Master', null, null, 'QSPMaster');
     $this->addCondition('type', 'Supplier');
     $this->getElement('status')->defaultValue('Active');
     $this->addHook('afterSave', $this);
     $this->addHook('beforeDelete', $this);
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }
Exemple #6
0
 function init()
 {
     parent::init();
     $this->getElement('created_by_id');
     //->defaultValue($this->app->employee->id);
     $cust_j = $this->join('customer.contact_id');
     $cust_j->hasOne('xepan\\accounts\\Currency', 'currency_id');
     $cust_j->hasOne('xepan\\base\\Country', 'billing_country_id')->display(array('form' => 'xepan\\commerce\\DropDown'));
     $cust_j->hasOne('xepan\\base\\State', 'billing_state_id')->display(array('form' => 'xepan\\commerce\\DropDown'));
     $cust_j->hasOne('xepan\\base\\Country', 'shipping_country_id')->display(array('form' => 'xepan\\commerce\\DropDown'));
     $cust_j->hasOne('xepan\\base\\State', 'shipping_state_id')->display(array('form' => 'xepan\\commerce\\DropDown'));
     // $cust_j->hasOne('Users','users_id')->mandatory(true)->sortable(true);
     $cust_j->addField('billing_address')->type('text');
     $cust_j->addField('billing_city');
     $cust_j->addField('billing_pincode');
     $cust_j->addField('same_as_billing_address')->type('boolean');
     $cust_j->addField('shipping_address')->type('text');
     $cust_j->addField('shipping_city');
     $cust_j->addField('shipping_pincode');
     $cust_j->addField('tin_no');
     $cust_j->addField('pan_no');
     $this->hasMany('xepan/commerce/Model_QSP_Master', null, null, 'QSPMaster');
     $this->hasMany('xepan/commerce/Model_Designer_Image_Category', 'contact_id');
     $this->hasMany('xepan/commerce/Model_Credit', 'customer_id');
     $this->hasMany('xepan/commerce/FreelancerCatAndCustomerAssociation', 'customer_id', 'FreelancerCategoryAssociation');
     $this->addExpression('customer_currency_icon', function ($m, $q) {
         return $m->refSQL('currency_id')->fieldQuery('icon');
     });
     $this->addExpression('organization_name', function ($m, $q) {
         return $q->expr('IF(ISNULL([organization_name]) OR trim([organization_name])="" ,[contact_name],[organization_name])', ['contact_name' => $m->getElement('name'), 'organization_name' => $m->getElement('organization')]);
     });
     //TODO Extra Organization Specific Fields other Contacts
     $this->getElement('status')->defaultValue('Active');
     $this->addCondition('type', 'Customer');
     $this->addHook('afterSave', $this);
     $this->addHook('beforeDelete', [$this, 'checkQSPExistance']);
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }
Exemple #7
0
 function init()
 {
     parent::init();
     $config_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['lead_source' => 'text'], 'config_key' => 'MARKETING_LEAD_SOURCE', 'application' => 'marketing']);
     $config_m->tryLoadAny();
     $this->getElement('source')->enum(explode(',', $config_m['lead_source']));
     $this->getElement('created_by_id')->defaultValue($this->app->employee->id);
     $this->addExpression('open_count')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_Opportunity', ['table_alias' => 'open_count'])->addCondition('lead_id', $q->getField('id'))->addCondition('status', 'Open')->count();
     });
     $this->addExpression('converted_count')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_Opportunity', ['table_alias' => 'converted_count'])->addCondition('lead_id', $q->getField('id'))->addCondition('status', 'Converted')->count();
     });
     $this->addExpression('rejected_count')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_Opportunity', ['table_alias' => 'rejected_count'])->addCondition('lead_id', $q->getField('id'))->addCondition('status', 'Rejected')->count();
     });
     $this->addExpression('total_visitor')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_LandingResponse')->addCondition('contact_id', $q->getField('id'))->count();
     });
     $this->addExpression('score')->set(function ($m, $q) {
         $ps = $m->add('xepan\\base\\Model_PointSystem');
         $ps->addCondition('contact_id', $q->getField('id'));
         return $q->expr('IFNULL([0],0)', [$ps->sum('score')]);
     });
     $this->addExpression('last_communication')->set(function ($m, $q) {
         $last_commu = $m->add('xepan\\communication\\Model_Communication');
         $last_commu->addCondition($last_commu->dsql()->orExpr()->where('from_id', $q->getField('id'))->where('to_id', $q->getField('id')))->setOrder('id', 'desc')->setLimit(1);
         return $q->expr('DATE_FORMAT([0],"%M %d, %Y")', [$last_commu->fieldQuery('created_at')]);
     });
     $this->hasMany('xepan\\marketing\\Opportunity', 'lead_id', null, 'Opportunities');
     $this->hasMany('xepan\\marketing\\Lead_Category_Association', 'lead_id');
     $this->getElement('status')->defaultValue('Active');
     $this->addHook('beforeDelete', [$this, 'checkContactIsLead']);
     $this->addHook('beforeDelete', [$this, 'checkExistingOpportunities']);
     $this->addHook('beforeDelete', [$this, 'checkExistingCategoryAssociation']);
     $this->addHook('beforeSave', [$this, 'updateSearchString']);
 }