Page 1 of 1

JiwaJobCosting Stages collection of Job object

PostPosted: Thu May 12, 2022 10:18 am
by indikad
Jiwa 7.2.1

I am trying to replicate the following Jiwa 6.5.13 code within the
JiwaFinancials.Jiwa.JiwaJobCostingUI.MainForm SavingStart event. any ideas ?
Code: Select all


public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      if(JiwaForm is JiwaFinancials.Jiwa.JiwaJobCostingUI.MainForm)
      {
         JiwaFinancials.Jiwa.JiwaJobCostingUI.MainForm  jobCostingMainForm = (JiwaFinancials.Jiwa.JiwaJobCostingUI.MainForm )JiwaForm;         
         _jobCostingMainForm =  jobCostingMainForm;
         _Plugin = Plugin;                           
         jobCostingMainForm.Job.SavingStart  += JobSavingStart;         
      }      
    }
   private void JobSavingStart()


jiwa 6 code/s are
Code: Select all
JobObject.m_Stages
For j = 1 To JobObject.m_Stages.Count
         JobObject.m_Stages.Item(j).ClassDescription = "somedesc "
         JobObject.m_Stages.Item(j).ClassificationID = "xxxxx12345"
      Next
// and
         JobObject.m_Stages.Item(i).m_Budget.MaterialCreditorCharge
    JobObject.m_Stages.Item(i).m_Budget.JournalCharge
    JobObject.m_Stages.Item(i).m_Budget.CashBookCharge
    JobObject.m_Stages.Item(i).m_Budget.ResourceCharge
    JobObject.m_Stages.Item(i).m_Budget.LabourCharge
    JobObject.m_Stages.Item(i).m_Budget.MaterialCharge
    JobObject.m_Stages.Item(i).m_Budget.PurchaseCharge

Re: JiwaJobCosting Stages collection of Job object  Topic is solved

PostPosted: Thu May 12, 2022 10:35 am
by Scott.Pearce
Code: Select all
For j = 1 To JobObject.m_Stages.Count
    JobObject.m_Stages.Item(j).ClassDescription = "somedesc "
    JobObject.m_Stages.Item(j).ClassificationID = "xxxxx12345"
Next


Becomes:

Code: Select all
JiwaFinancials.Jiwa.JiwaJobCosting.Job jobObject = (JiwaFinancials.Jiwa.JiwaJobCosting.Job)JiwaBusinessLogic;
foreach(JiwaFinancials.Jiwa.JiwaJobCosting.CostCentre costCentre in jobObject.CostCentres)
{
    foreach(JiwaFinancials.Jiwa.JiwaJobCosting.Stage stage in costCentre.Stages)
    {
        stage.Classification.ReadRecord("xxxxx12345");
    }
}


and

Code: Select all
JobObject.m_Stages.Item(i).m_Budget.MaterialCreditorCharge
JobObject.m_Stages.Item(i).m_Budget.JournalCharge
JobObject.m_Stages.Item(i).m_Budget.CashBookCharge
JobObject.m_Stages.Item(i).m_Budget.ResourceCharge
JobObject.m_Stages.Item(i).m_Budget.LabourCharge
JobObject.m_Stages.Item(i).m_Budget.MaterialCharge
JobObject.m_Stages.Item(i).m_Budget.PurchaseCharge


would become something like:

Code: Select all
JiwaFinancials.Jiwa.JiwaJobCosting.Budget budget = jobObject.CostCentres[myCostCentreID].Stages[myStageID].Budgets[1];
budget.JournalCharge = 0;
budget.CashBookCharge = 0;
budget.ResourceCharge = 0;
budget.LabourCharge = 0;
budget.MaterialCharge = 0;
budget.PurchaseCharge = 0;