www.pudn.com > Delphi-Script-30.rar > brcstord.js, change:2012-04-12,size:2911b


//USEUNIT dcdbctl 
//USEUNIT DBGrids 
//USEUNIT StdCtrls 
//USEUNIT DBCtrls 
//USEUNIT Buttons 
//USEUNIT ExtCtrls 
//USEUNIT Edcust 
//USEUNIT Qrycust 
//USEUNIT Edorders 
//USEUNIT Datamod 
 
var  FActiveSource; 
 
 
//------------------------------------------------------------------- 
 
function GetCustNo() 
{ 
  return  MastData.CustMasterSrc.Dataset.Fields(0).Value; 
} 
 
//------------------------------------------------------------------- 
 
function SetCustNo(NewCustNo) 
{ 
  MastData.CustMasterSrc.Dataset = MastData.Cust; 
  MastData.Cust.Locate("CustNo", NewCustNo, 0); 
} 
 
//------------------------------------------------------------------- 
 
function GetOrderNo() 
{ 
  return  MastData.OrdByCustOrderNo.Value; 
} 
 
//------------------------------------------------------------------- 
 
function SetOrderNo(NewOrderNo) 
{ 
  MastData.OrdByCust.Locate("OrderNo", NewOrderNo, 0); 
} 
 
//------------------------------------------------------------------- 
 
function SetActiveSource(DataSource) 
{ 
  FActiveSource = DataSource; 
  Navigator.DataSource = FActiveSource; 
} 
 
//------------------------------------------------------------------- 
 
function CustGridEnter(Sender) 
{ 
  SetActiveSource(MastData.CustMasterSrc); 
  CustGrid.Options |= mkset(dgAlwaysShowSelection); 
  OrdersGrid.Options &= ~mkset(dgAlwaysShowSelection); 
} 
 
//------------------------------------------------------------------- 
 
function OrdersGridEnter(Sender) 
{ 
  SetActiveSource(MastData.OrdByCustSrc); 
  OrdersGrid.Options |= mkset(dgAlwaysShowSelection); 
  CustGrid.Options &= ~mkset(dgAlwaysShowSelection); 
} 
 
//------------------------------------------------------------------- 
 
function SetQuery(Sender) 
{ 
  if (QueryCustDlg.ShowModal == mrOK) 
    ActivateQuery(BrCustOrdForm); 
} 
 
//------------------------------------------------------------------- 
 
function ActivateQuery(Sender) 
{ 
  if (!ActivateBtn.Down ) 
    MastData.CustMasterSrc.Dataset = MastData.Cust; 
  else 
    with (MastData.CustQuery) 
    { 
      Close; 
      ParamByName("FromDate").AsDateTime = Qrycust.GetFromDate(); 
      ParamByName("ToDate").AsDateTime = Qrycust.GetToDate(); 
      Open; 
      if (BOF && EOF) 
         Abort; 
      MastData.CustMasterSrc.Dataset = MastData.CustQuery; 
    } 
} 
 
//------------------------------------------------------------------- 
 
function EditBtnClick(Sender) 
{ 
var F 
  F = FActiveSource.Dataset.Fields(0); 
  if (FActiveSource == MastData.CustMasterSrc) 
    Edcust.Edit(F.Value); 
  else 
  { 
    Edorders.Edit(F.Value); 
    FActiveSource.Dataset.Refresh; 
  } 
} 
 
//------------------------------------------------------------------- 
 
function CloseBtnClick(Sender) 
{ 
  Close; 
} 
 
//------------------------------------------------------------------- 
 
function FormShow(Sender) 
{ 
  MastData.Cust.Open; 
  MastData.Cust.First; 
}