Код: Выделить всё
!#include %src%\make\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: comp;
pptitlenrec,unitm:comp;
// titlenrec: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;
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;
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, katpodr,katmc, x$users, katpodr katpodr_2, katmc katmc_2
where(( normzapas.cpodrazd==katpodr.nrec
and normzapas.cmc==katmc.nrec
and normzapas.atl_owner==x$users.atl_nrec
and katpodrnrec == katpodr_2.nrec
and pmc == katmc_2.nrec));
window NormCorrect 'Редактирование норм';
show at(,,,28);
toolbar F_Common::tbPrintDoc;
screen sCornormzapas(,,SciAqaSwitchItemName);
show at (,,,10);
table katpodr;
//table pptitle;
bevel be1 {1,0,110,10,bsRaised, bsFrame};
fields
normzapas.pdate :noprotect;
normzapas.pbdate:noprotect;
normzapas.pedate:noprotect;
normzapas.npp:noprotect,noPickButton; //:noprotect; //(,,sciAQACancel1)
katpodr.name :pickButton, protect;
<<
Дата Начало действия Конец действия
.@@@@@@@@@ .@@@@@@@@@ .@@@@@@@@@
Номер Структурное подразделение
.@@@@@@@@@@@@ .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>>
end;
browse bCornormzapas(,,Sci13478Esc )//F1,F4,F7,F8,Esc//(,,sci178EnEsc)
show at (,11,,22)
table katmc;
fields
katmc.name 'Наименование МЦ' : [20], pickButton;
normzapas.kol 'Количество':[5,'666.88'],noprotect,noPickButton;
end;
end;
handleEvent
cmInit:
{
! message('cminit2');
RescanPanel(Scornormzapas);
Rescanpanel(#normzapas);
}
cmPick:
{
Updatetable();
case CurField of
#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:
{
cmc := normzapas.cmc;
res := runinterface('iGetKau.GetCodeKau', pmc);
normzapas.cmc := pmc;
! normzapas.kol := tmppick.kol;
update current normzapas;
if getfirst katmc where((normzapas.cmc==katmc.nrec))=tsOk
{
}
RescanPanel(#normzapas);
}
end;
}
cmCheckField : update current normzapas;
cmCancel:
{
}
cmPrintDoc:
{
message ('Печать!!!');
! titlenrec:=pptitle.atl_nrec;
UpdateTable();
res:=RunInterface('ireport',titlenrec);
}
cmClose:
{
CloseWindow(cmDefault);
}
cmDefault:
{
PutCommand(cmCheckField);
! message('cmdefault2');
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:
{
! message('cmdone2');
rescanpanel(#normzapas);
}
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;
end;
//end;
tableevent table normzapas
cmSetDefault: {
normzapas.pdate:=Cur_Date();
normzapas.cpodrazd:=0;
normzapas.npp := (normzapas.npp)+1;
SetModified(true);
UpDateTableWithInserted
PutCommand(cmDefault);
}
cmUpdateRecord :{ //if grant_s=false
//{
update current normzapas;
//}
}
cmInsertRecord :{
insert current normzapas;
UpDatePanels();
}
cmDeleteRecord :
{
if Message('Удалить нормы?', yesButton + noButton) = cmYes
{
Delete Current normzapas;
}
}
cmCheckRecord:
{
MakeValid(#normzapas);
if isvalid(#normzapas)
{
update current normzapas;
}
if isnew
{
Putcommand(cmInsertRecord);
}
}
cmCheckField:
{
! message('dfsdf');
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;
end.