Here, is the code i will tell what is happening here this about gantt chart on that chart there is batches when i'm selecting a batch and moving it. the dates will change it is happening here thats fine and it is happening in empty area. what my problem is that when i'm moving the batch into set of batches the set of batches have to give place to the newly moving batch i.e., set of batches date has to change accordingly but it is not happening here. pls tell me what to do i have stuck here.........!!
void CGanttChartView::OnControlclickActiveganttvcctl1(LPDISPATCH e)
{
int Index;
CclsTask oTask;
CString strBatchCode, m_strRecDelID;;
CMouseEventArgs oE(e);
CPoint right;
right.x = oE.GetX();
right.y = oE.GetY();
CRecordset ganttChartRecordSet;
if (oE.GetEventTarget() == EVT_TASK||oE.GetEventTarget() == EVT_SELECTEDTASK) {
Index = ActiveGanttVCCtl1.GetMathLib().GetTaskIndexByPosition(oE.GetX(), oE.GetY());
if (Index < 1)
{
return;
}
oTask= ActiveGanttVCCtl1.GetTasks().Item(CStr(Index));
strBatchCode=oTask.GetText();
sRowKey = oTask.GetRowKey();
m_dtStartDate.CreateDispatch(_T("AGVC.DateTime"));
m_dtEndDate.CreateDispatch(_T("AGVC.DateTime"));
sbatchNode.dtStartDate = oTask.GetStartDate();
sbatchNode.dtEndDate = oTask.GetEndDate();
m_dtStartDate=oTask.GetStartDate();
m_dtEndDate=oTask.GetEndDate();
m_sStDate=m_dtStartDate.ToString(_T("MM/dd/yy HH:mm"));
m_sEndDate=m_dtEndDate.ToString(_T("MM/dd/yy HH:mm"));
sbatchNode.sStartDate = sbatchNode.dtStartDate.ToString(_T("MM/dd/yyyy HH:mm:ss"));
sbatchNode.sEndDate =sbatchNode.dtEndDate.ToString(_T("MM/dd/yyyy HH:mm:ss"));
CString sTaskKey = oTask.GetKey();
CString csRowNo;
csRowNo.Format(_T("%c"),sRowKey.GetAt(1));
CRecordset ganttRecordSet(&theApp.data);
if (theApp.m_pGeneric->OpenRecordSet(&ganttRecordSet, GetSQLStatement(GANTT_CHART_DELIVERY_TYPE,CRecordset::readOnly,csRowNo) ))
ganttRecordSet.GetFieldValue((short)0, csRecDelType);
ganttRecordSet.GetFieldValue((short)1, m_sLocationId);
ganttRecordSet.GetFieldValue((short)2,m_sRecDelId);
ganttRecordSet.Close();
m_strRecDelID.LoadStringA(IDS_CALCTYPE);
m_mapBatchFlow.Lookup(sTaskKey, SBatchFlowRec);
sbatchNode.strBatchCode= SBatchFlowRec->strBatch_Desc;
sbatchNode.strRate=m_sSimRate=SBatchFlowRec->strRate;
sbatchNode.strVolume=m_sVolume=SBatchFlowRec->strVolume_In_Barrels;
sbatchNode.strDuration=m_sDuration=SBatchFlowRec->strDuration;
sbatchNode.strProduct=SBatchFlowRec->strProduct;
sbatchNode.dtStartDate.ReleaseDispatch();
sbatchNode.dtEndDate.ReleaseDispatch();
m_dtStartDate.ReleaseDispatch();
m_dtEndDate.ReleaseDispatch();
m_startDateTime=sbatchNode.sStartDate;
m_completeDateTime=sbatchNode.sEndDate;
ganttRecordSet.Open(CRecordset::forwardOnly,GetSQLStatement(GET_PRM_ID,ACTIVE,sbatchNode.strBatchCode),CRecordset::readOnly);
ganttRecordSet.GetFieldValue((short)0, nPrmId);
m_sID=nPrmId;
sbatchNode.strPrmBatchID=nPrmId;
ganttRecordSet.GetFieldValue((short)1, nSecId);
sbatchNode.strSecBatchID=nSecId;
ganttRecordSet.Close();
}
if((oE.GetButton() == BTN_RIGHT) && !(csRecDelType == m_strRecDelID) && (oE.GetEventTarget() == EVT_TASK||oE.GetEventTarget() == EVT_SELECTEDTASK))
{
CMenu mnuPopupSubmit;
mnuPopupSubmit.LoadMenu(IDR_MENU1);
CMenu *mnuPopupMenu = mnuPopupSubmit.GetSubMenu(0);
ASSERT(mnuPopupMenu);
ClientToScreen(&right);
mnuPopupMenu->TrackPopupMenu( TPM_LEFTALIGN, right.x, right.y, this);
}
}