Код: Выделить всё
#include %src%\src\normzapas.vih;
#include %src%\src\vipInterface.h;
!#include %src%\src\GetKau.vih
!#include %src%\src\Galnet.ccm;
interface Normzapas 'Нормы страхового запаса';
!#include %src%\src\GetKau.var
show at (,,92,25);
const
cmPrintDoc = 3440;
end;
var
nr,mcnrec,katednrec,katpodrnrec,linenrec,formatnrec,katstannrec,ctitle,titlenrec,specnrec, katnotesnrec: comp;
pptitlenrec,unitm:comp;
wkl,grant_s, check_del, checkspecif,check_screen:boolean;
res,check_i : word;
nmc:string;
pdate, pbdate, pedate : date;
statusnnrec:comp;
UnMea,plancopy:string;
somewindow:longint;
n:longint;
wValues: array [1..3] of word;
lValues: array [1..3] of comp;
sValues: array [1..1] of string;
begindate,enddate:date;
sort1,teh_poteri,dek1,dek2,dek3,summ_plan,poludek1,poludek2,poludek3,summ_polu:double;
sum_gresbordur,gresbordur1,gresbordur2,gresbordur3:double;
sum_vstavka,vstavka1,vstavka2,vstavka3:double;
maxi,maxs:word;
butpick:longInt;
nomer_plana,formatname:string;
linia_name,podrasd,titlenpp:string;
status_plana,old_status,old_linia :comp;
v1 : iSecurity_norm;
create view normz
var status,linia_filter,grup_filter,format_filter, nomer_plana: word;
x:integer;
fldselect:longint;
linia,gruppa,etalon,format,titlenrec,specifnrec,specifnrec2,specifnrec3, pmc:comp;
(Vsego,meash)
as select katpodr.name,normzapas.npp, *
from normzapas, normzapasspec, katpodr, katmc, x$users, katnotes, katpodr katpodr_2, ppstatus//, katmc katmc_2
where(( normzapas.cpodrazd==katpodr.nrec
and normzapas.atl_nrec == normzapasspec.cnorm
and normzapasspec.cmc==katmc.nrec
! and comp(userid) == x$users.atl_nrec //normzapas.atl_owner
and normzapas.atl_owner==x$users.atl_nrec
and katpodrnrec == katpodr_2.nrec
and normzapas.cstatus == katnotes.nrec
! and katmc.nrec == katmc_2.nrec
! and pmc == katmc.nrec
))
order by normzapas.npp;
window NormCorrect 'Редактирование норм';
show at(,,,28);
toolbar F_Common::tbPrintDoc;
screen sCornormzapas(,,sci1EnEsc); //SciAqaSwitchItemName
show at (,,,10);
table katpodr;
bevel be1 {1,0,110,10,bsRaised, bsFrame};
fields
normzapas.pdate :protect;
normzapas.pbdate:noprotect;
normzapas.pedate:noprotect;
normzapas.npp:protect,noPickButton; //:noprotect; //(,,sciAQACancel1)
katpodr.name :pickButton, protect;
! status : [ list 'item 1', 'item 2', 'item 3' ];
! ppstatus.name (,,SciAqaSwitchItemName) : [ list 'item 1', 'item 2', 'item 3' ];
katnotes.name :pickButton, protect;
<<
Дата Начало действия Конец действия
.@@@@@@@@@ .@@@@@@@@@ .@@@@@@@@@
Номер Структурное подразделение
.@@@@@@@@@@@@ .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Статус .@@@@@@@@@@@@@@@@@@@@@
>>
end;
screen sCornormzapas_nogrant(,,sci1EnEsc); //SciAqaSwitchItemName
show at (,,,10);
table katpodr;
bevel be1 {1,0,110,10,bsRaised, bsFrame};
fields
normzapas.pdate :protect;
normzapas.pbdate:protect;
normzapas.pedate:protect;
normzapas.npp:protect,noPickButton; //:noprotect; //(,,sciAQACancel1)
katpodr.name :pickButton, protect, skip;
! status : [ list 'item 1', 'item 2', 'item 3' ];
! ppstatus.name (,,SciAqaSwitchItemName) : [ list 'item 1', 'item 2', 'item 3' ];
katnotes.name :pickButton, protect;
<<
Дата Начало действия Конец действия
.@@@@@@@@@ .@@@@@@@@@ .@@@@@@@@@
Номер Структурное подразделение
.@@@@@@@@@@@@ .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Статус .@@@@@@@@@@@@@@@@@@@@@
>>
end;
handleevent
cmInit:
{
if IsProtected(#normzapas) = true
{
SetFormat(sCornormzapas_nogrant);
RescanPanel(sCornormzapas_nogrant);
Rescanpanel(#normzapas);
}
else
{
SetFormat(sCornormzapas);
RescanPanel(sCornormzapas);
Rescanpanel(#normzapas);
}
! if getfirst normzapas where((comp(userid) == normzapas.atl_owner))=tsOk
! {
! }
RescanPanel(Scornormzapas);
Rescanpanel(#normzapas);
}
cmPrintDoc:
{
UpdateTable();
res:=RunInterface('ireport',titlenrec);
}
end;
! browse bCornormzapas(,,Sci13478Esc )//F1,F4,F7,F8,Esc//(,,sci178EnEsc)
browse bCornormzapas(,,Sci178EnEsc )//F1,F4,F7,F8,Esc//(,,sci178EnEsc) sci1478EnEscTreeI
show at (,11,,22)
table normzapasspec;
fields
katmc.name 'Наименование МЦ' : [20], pickButton;
normzapasspec.kol 'Количество':[5,'666.88'],noprotect,noPickButton;
end;
procedure grants();
{
if(v1.fSecurityPolicy(sGetTune('USER.descr'),normzapas.atl_nrec,normzapas.cstatus) = FALSE )
{
cfsSetProp('bnormzapas','StatusCtx', Sci17EnEsc);
cfsSetProp('bCornormzapas','StatusCtx',sciAQACancel1);
cfsSetProp('status','StatusCtx',SciAqaSwitchItemName);
SetFormat(sCornormzapas);
// cfsSetProp('sCorPPlan_nogrant','StatusCtx',sciAQACancel1);
// SetFieldOption(#ppspecif.npp,ofProtected);
grant_s:=false;
// message('grant_s false');
}
else if(v1.fSecurityPolicy(sGetTune('USER.descr'),normzapas.atl_nrec,normzapas.cstatus) = true )
{
if( getfirst x$users where (( sGetTune('USER.descr') == x$users.XU$LOGINNAME )) = tsOk )
{
// cfsSetCurrentContainer('Plan.PlanCorrect.sCorPPlan');
// cfsCreateObject('button', 'sCorPPlan', 'Etalons', false, butpick);
if (x$users.xu$type=1)
{
// SetFieldOption(#ppspecif.npp,ofSelectable);
// if (x$users.xu$type=1 and x$users.xu$loginname='pivovarchukaa')
// {
//message('full_grants');
cfsSetProp('Bnormzapas','StatusCtx',Sci178EnEsc);
SetFormat(sCornormzapas);
cfsSetProp('bCornormzapas','StatusCtx',Sci13478Esc);
cfsSetProp('sCornormzapas','StatusCtx',SciAqaSwitchItemName);
// }
// message('grant_s true');
}
else
{
//message('grants');
cfsSetProp('Bnormzapas','StatusCtx',Sci178EnEsc);
SetFormat(sCornormzapas);
cfsSetProp('bCornormzapas','StatusCtx',Sci13478Esc);
cfsSetProp('sCornormzapas','StatusCtx',SciAqaSwitchItemName);
}
grant_s:=true;
}
}
rescanpanel(#normzapas);
}
tableevent table normzapasspec
cmSetDefault:
{
set normzapasspec.cnorm :=normzapas.atl_nrec
}
cmUpdateRecord :
{ //if grant_s=false
//{
update current normzapasspec;
//}
}
cminsertrecord:
{
insert current normzapasspec;
UpDatePanels();
}
cmDeleteRecord :
{
Delete Current normzapasspec;
}
end;
end;
browse bnormzapas(,,Sci178EnEsc)
table normzapas;
fields
normzapas.pdate 'Дата' : [15] , protect, noAutoSize;
normzapas.npp 'Номер' : [25], protect, noAutoSize;
katpodr.name 'Подразделение' : [25] , protect, noAutoSize;
x$users.xu$fullname 'Создатель':[20],protect,noAutoSize;
katnotes.name 'Статус':[20],protect,noAutoSize;
end;
//end;
tableevent table normzapas
cmSetDefault: {
normzapas.pdate:=Cur_Date();
normzapas.cpodrazd:=0;
normzapas.cstatus := comp ('4001F55A5B805E36h')
normzapas.npp := 1;
SetModified(true);
UpDateTableWithInserted
PutCommand(cmDefault);
}
cmUpdateRecord :{ if not IsProtected(#normzapas)
{
update current normzapas;
}
}
cmInsertRecord :{
insert current normzapas;
! insert current normzapasspec;
UpDatePanels();
}
cmDeleteRecord :
{
if Message('Удалить нормы?', yesButton + noButton) = cmYes
{
Delete Current normzapas;
Delete Current normzapasspec;
}
}
cmCheckRecord:
{
MakeValid(#normzapas);
if isvalid(#normzapas)
{
update current normzapas;
}
if isnew
{
Putcommand(cmInsertRecord);
}
}
cmCheckField:
{
updatetable;
SetModified(true);
case CurField of
#normzapas.pbdate:
{
update current normzapas;
RescanPanel(#normzapas);
}
#normzapas.pedate:
{
update current normzapas;
RescanPanel(#normzapas);
}
#normzapas.pdate:
{
update current normzapas;
RescanPanel(#normzapas);
}
#normzapas.npp:
{
update current normzapas;
RescanPanel(#normzapas);
}
end;
}
end;
handleEvent
cmInit:
{
if IsProtected(#normzapas) = true
{
SetFormat(sCornormzapas_nogrant);
RescanPanel(sCornormzapas_nogrant);
Rescanpanel(#normzapas);
}
else
{
SetFormat(sCornormzapas);
RescanPanel(sCornormzapas);
Rescanpanel(#normzapas);
}
! if getfirst normzapas where((comp(userid) == normzapas.atl_owner))=tsOk
! {
! }
RescanPanel(Scornormzapas);
Rescanpanel(#normzapas);
}
cmPick:
{
if pr_CurUserAdmin = true
{
case CurField of
#katnotes.name:
{
res:=RunInterface('L_DOGOVOR::GETSOMKATNOTES', 0, word(1), 0, false, katnotesnrec);
normzapas.cstatus:=katnotesnrec
update current normzapas;
if getfirst katnotes where((normzapas.cstatus==katnotes.nrec))=tsOk
{
}
putcommand(cminit);
ReReadRecord(#normzapasspec);
ReReadRecord(#normzapas);
! RescanPanel(#normzapas);
}
end;
}
ReReadRecord(#normzapasspec);
ReReadRecord(#normzapas);
if IsProtected(#normzapas) = true
{
break;
ReReadRecord(#normzapasspec);
ReReadRecord(#normzapas);
}
! Rescanpanel(#normzapas);
! Rescanpanel(#normzapasspec);
Updatetable();
case CurField of
#katnotes.name:
{
res:=RunInterface('L_DOGOVOR::GETSOMKATNOTES', 0, word(1), 0, false, katnotesnrec);
normzapas.cstatus:=katnotesnrec
update current normzapas;
if getfirst katnotes where((normzapas.cstatus==katnotes.nrec))=tsOk
{
}
ReReadRecord(#normzapasspec);
ReReadRecord(#normzapas);
! RescanPanel(#normzapas);
}
#katpodr.name:
{
katpodrnrec:=normzapas.cpodrazd;
res:=RunInterface('Z_KATPODR::GETANYPODR',katpodrnrec);
normzapas.cpodrazd:=katpodrnrec
update current normzapas;
if getfirst katpodr where((normzapas.cpodrazd==katpodr.nrec))=tsOk
{
}
RescanPanel(#normzapas);
}
#katmc.name:
{
pmc := normzapasspec.cmc;
res := runinterface('L_MCU::GetSomeMC_KatMC', pmc, false, -12345);//вызов интерфейса выбора МЦ без ввода количества
! res := runinterface('L_MCU::GetSomeMC', pmc);
! res := runinterface('iGetKau.GetCodeKau', pmc);
normzapasspec.cmc := pmc;
update current normzapasspec;
if getfirst katmc where((normzapasspec.cmc==katmc.nrec))=tsOk
{
}
RescanPanel(#normzapasspec);
}
end;
}
cmCheckField : update current normzapas;
cmCancel:
{
}
cmpositionchanged:
{
var ww_status:word;
ww_status:=0;
if isvalid(tnKatNotes)
ww_status:=katnotes.status;
ProtectRecord(tnnormzapas,ww_status<>0);
ProtectRecord(tnnormzapasspec,ww_status<>0);
! if getfirst normzapas where((comp(4612066703671205222) == normzapas.cstatus))=tsOk
! {
! protectrecord(#normzapas, true);
! protectrecord(#normzapasspec, true);
! }
! if getfirst normzapas where((comp(4612010840391242927) == normzapas.cstatus))=tsOk
! {
! protectrecord(#normzapas, true);
! protectrecord(#normzapasspec, true);
! }
}
cmProtectedInput :
{
! if (CurField = #KatNotes.Name)
! {
! ProtectRecord(#normzapas, false);
! PutCommand(cmPick);
! Stop;
! }
Stop;
}
cmPrintDoc:
{
UpdateTable();
res:=RunInterface('ireport',titlenrec);
}
cmClose:
{
CloseWindow(cmDefault);
}
cmDefault:
{
PutCommand(cmCheckField);
runwindowmodal(NormCorrect);
Rescanpanel(#normzapas);
}
cmInsert:
{
! message('cminsert1');
! titlenrec:=normzapas.atl_nrec;
! maxs:=normzapas.npp;
! specnrec:=normzapas.npp;
!! _loop normzapas where ((titlenrec==normzapas.atl_nrec))
!! {
! if (maxs<normzapas.npp) or (maxs=normzapas.npp)
! {
! message('cminsert2');
! normzapas.npp:=normzapas.npp+1;
! update current normzapas;
! }
!// maxs:=maxs+1;
!! }
! maxs:=maxs+1;
}
cmDelete:
{
}
cmDone:
{
rescanpanel(#normzapas);
}
end;
end.