📄 pm_pc_entry_b.pas
字号:
If not AdoQry_Tmp.Eof then
begin
DispInfo('不能删除采购价格单号为:'+Edt_PcNo.text+chAr(13)+'物料代码为:'+AdoQry_Body.fieldbyname('ItemCode').asstring+' 已下采购单的合同!',3);
abort;
end;
end;}
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Insert #PcLine(PcNo,ItemCode,PcTaxPrice,PcNoTaxPrice'
+',PcStArtDate,PcendDate,PcStArtQty,PcendQty,PcPriceType,PcTaxPrice_Formal,PcNoTaxPrice_Formal, '
+' ReferencePricePass,FormalPricePass)'
+' Values('
+' '''+AdoQry_Body.fieldbyname('PcNo').AsString+''''
+','''+AdoQry_Body.fieldbyname('ItemCode').AsString+''''
+','+AdoQry_Body.fieldbyname('PcTaxPrice').AsString+''
+','+AdoQry_Body.fieldbyname('PcNoTaxPrice').AsString+''
+','''+AdoQry_Body.fieldbyname('PcStArtDate').AsString+''''
+','''+AdoQry_Body.fieldbyname('PcendDate').AsString+''''
+','+AdoQry_Body.fieldbyname('PcStArtQty').AsString+''
+','+AdoQry_Body.fieldbyname('PcendQty').AsString+''
+','+AdoQry_Body.fieldbyname('PcPriceType').AsString+''
+','+AdoQry_Body.fieldbyname('PcTaxPrice_Formal').AsString
+','+AdoQry_Body.fieldbyname('PcNoTaxPrice_Formal').AsString
+','+AdoQry_Body.fieldbyname('ReferencePricePass').AsString
+','+AdoQry_Body.fieldbyname('FormalPricePass').AsString
// +','+AdoQry_Body.fieldbyname('PCReferencedPrice').AsString+''
+')';
AdoQry_Tmp.ExecSQL;
AdoQry_Body.Delete;
Act_Save.Enabled:=True;
if AdoQry_Body.IsEmpty then
for i:=0 to Pnl_Head.ControlCount-1 do
begin
if(not(Pnl_Head.Controls[i] is TLabel))then
Pnl_Head.Controls[i].Enabled:=True;
end;
end
else if(CanDelete=False)then
DispInfo(' 不能从中间删除连续的项目 ',3);
end;
end;
procedure TFrm_Pm_Pc_Entry_B.ExtEdt_VendorCodeChange(Sender: TObject);
begin
inherited;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select Vendor.VendorTAXRATE_PERCENT,Vendor.VendorName'
+',Vendor.CurrencyCode,Currency.CurrencyName'
+',Vendor.CurrencyCode+'' ''+Currency.CurrencyName As CurrencyCodeName'
+' From Vendor Left Join Currency on Vendor.CurrencyCode=Currency.CurrencyCode'
+' Where Vendor.VendorCode='''+TExtEdit(Sender).Text+'''';
AdoQry_Tmp.Open;
Edt_VendorName.Text :=AdoQry_Tmp.fieldbyname('VendorName').AsString;
Lbl_VendorName.Caption :=AdoQry_Tmp.fieldbyname('VendorName').AsString;
Lbl_TaxRate.Caption:=AdoQry_Tmp.fieldbyname('VendorTAXRATE_PERCENT').AsString;
Lbl_Currency.Caption:=AdoQry_Tmp.fieldbyname('CurrencyCodeName').AsString;
Edt_TaxRate.Text:=AdoQry_Tmp.fieldbyname('VendorTAXRATE_PERCENT').AsString;
Edt_CurrencyCode.Text:=AdoQry_Tmp.fieldbyname('CurrencyCode').AsString;
Edt_CurrencyName.Text:=AdoQry_Tmp.fieldbyname('CurrencyName').AsString;
AllChange(Sender);
end;
procedure TFrm_Pm_Pc_Entry_B.IntegerCheck(Sender: TObject);
begin
inherited;
if StrToInt(TEdit(Sender).Text)>100 then
begin
DispInfo('税率不能大于100',3);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Pm_Pc_Entry_B.InitReport;
var
s1,s2,s3:String;
i:Integer;
begin
for i:=Length(ExtEdt_VendorCode.Text+' '+Lbl_VendorName.Caption) to 60 do
s1:=s1+' ';
for i:=Length(Lbl_Currency.Caption) to 30 do
s2:=s2+' ';
for i:=Length(Lbl_TaxRate.Caption) to 27 do
s3:=s3+' ';
inherited;
ExtPrintReport.Subtitle2:=Label2.Caption+' '+ExtEdt_VendorCode.Text+' '+Lbl_VendorName.Caption;
// +s1+Label1.Caption+' '+Edt_PcNo.Text;
ExtPrintReport.Subtitle3:=' '+Label8.Caption+' '+Lbl_Currency.Caption
+s2+Label3.Caption+' '+Lbl_TaxRate.Caption+'%'
+s3+Label9.Caption+' '+MEdt_BillDate.Text;
ExtPrintReport.Subtitle4:=' '+Label5.Caption+' '+Edt_RemArk.Text;
end;
procedure TFrm_Pm_Pc_Entry_B.AdoQueryAfterOpen(DataSet: TDataSet);
begin
inherited;
TFloatField(AdoQry_Body.fieldbyname('PcTaxPrice')).DisplayFormat:='0.######';
TFloatField(AdoQry_Body.fieldbyname('PcNoTaxPrice')).DisplayFormat:='0.######';
// TFloatField(AdoQry_Body.fieldbyname('PcTaxPrice_Formal')).DisplayFormat:='0.######';
// TFloatField(AdoQry_Body.fieldbyname('PcNoTaxPrice_Formal')).DisplayFormat:='0.######';
end;
procedure TFrm_Pm_Pc_Entry_B.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
try
if deleteflag then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Drop Table #PcLine';
AdoQry_Tmp.ExecSQL;
end;
except
end;
end;
procedure TFrm_Pm_Pc_Entry_B.Act_PreviewExecute(Sender: TObject);
begin
if Act_Save.Enabled = True then
begin
DispInfo('没有保存数据,不能预览!',1);
Abort;
end;
inherited;
end;
procedure TFrm_Pm_Pc_Entry_B.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
{ if AdoQry_Body.fieldbyname('PCReferencedPrice').asinteger =1 then
begin
// Background:=$00F9D1C6;
afont.Color:=clblue;
end;
}
end;
procedure TFrm_Pm_Pc_Entry_B.ExtEdt_VendorCodeExit(Sender: TObject);
var sqltext:string;
begin
inherited;
if Trim(Extedt_VendorCode.text)='' then exit;
VendorCodeCheck(sender);
If Status='Add' then
begin
SqlText := 'select * from PC '
+' where VendorCode='+QuotedStr(ExtEdt_VendorCode.Text);
ExecuteSQl(AdoQry_Tmp,SqlText,0);
if AdoQry_Tmp.RecordCount>0 then
begin
DispInfo('已存在该供应商的采购价格表!',3);
ExtEdt_VendorCode.SetFocus;
abort;
end;
end;
sqltext:='select Vendor.*,currencyName from Vendor,currency '
+' where Vendor.currencyCode=currency.currencyCode and VendorCode='+quotedstr(Tedit(sender).text);
Executesql(AdoQry_tmp,sqltext,0) ;
if AdoQry_tmp.RecordCount=0 then
begin
DispInfo('供应商代码错误!',3);
Tedit(sender).setfocus;
abort;
end;
edt_VendorName.Text:=AdoQry_tmp.fieldbyname('VendorName').asstring;
edt_taxrate.Enabled:=False;
If UpperCase(Status)='AdD' then
edt_taxrate.Text:=AdoQry_tmp.fieldbyname('VendorTAXRATE_PERCENT').asstring;
if Trim(edt_taxrate.text)='0' then edt_taxrate.Enabled:=True;
edt_CurrencyCode.Text:=AdoQry_tmp.fieldbyname('currencyCode').asstring;
edt_CurrencyName.Text:=AdoQry_tmp.fieldbyname('currencyName').asstring;
// VendorCodecheck(sender);
end;
procedure TFrm_Pm_Pc_Entry_B.Act_ModifyExecute(Sender: TObject);
begin
if AdoQry_Body.RecordCount=0 then exit;
Frm_Pm_Pc_Entry_D.VendorCode:=Trim(Extedt_VendorCode.text);
inherited;
end;
procedure TFrm_Pm_Pc_Entry_B.Act_InsertLineExecute(Sender: TObject);
begin
if Trim(Extedt_VendorCode.text)='' then
begin
DispInfo('供应商代码不能为空!',1);
Extedt_VendorCode.SetFocus;
Abort;
end;
Extedt_VendorCode.OnExit(Extedt_VendorCode);
Frm_Pm_Pc_Entry_D.VendorCode:=Trim(Extedt_VendorCode.text);
inherited;
end;
procedure TFrm_Pm_Pc_Entry_B.FormActivate(Sender: TObject);
begin
inherited;
// edt_Pcno.Enabled:=False;
if status='Add' then
begin
chb_Overdue.Enabled:=False;
chb_Overdue.Checked:=False;
end;
end;
procedure TFrm_Pm_Pc_Entry_B.chb_OverdueClick(Sender: TObject);
var BookmArk:string;
Bill_id:string;
begin
inherited;
Bill_id:=iifstring(status='Add',' ',AdoQry_Head.fieldbyname('pcno').asstring);
BookmArk:=AdoQry_Body.BookmArk;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:='Select pcline.PcNo'
+',PcLine.PcLineId'
+',PcLine.ItemCode'
+',Item.ItemName'
+',PcLine.PcLineStatus'
+',Uom.UomName'
+',PcLine.PcTaxPrice'
+',PcLine.PcNoTaxPrice'
+',PcLine.PcStArtDate'
+',PcLine.PcendDate'
+',PcLine.PcStArtQty'
+',PcLine.PcendQty'
+',PcLine.PcPriceType'
+',PcLine.PCReferencedPrice'
+' From PcLine Join Item On PcLine.ItemCode=Item.ItemCode'
+' Left Outer Join Uom On Item.UomCode=Uom.UomCode'
+' Where PcLine.PcNo='''+Bill_ID+''''
+iifstring(chb_Overdue.Checked,'',' and pcline.pcenddate>=getdate() ');
// showmessage(AdoQry_Body.sql.text) ;
AdoQry_Body.open;
if not AdoQry_Body.RecordCount=0 then
AdoQry_Body.BookmArk:=BookmArk;
end;
procedure TFrm_Pm_Pc_Entry_B.Act_FilterExecute(Sender: TObject);
var i:integer;
begin
for i:=0 to dbgrideh.Columns.Count-1 do
if Assigned(dbgrideh.Columns[i].Field) then
Dbgrideh.Columns[i].Field.Origin := '#tmptable';
inherited;
end;
function TFrm_Pm_Pc_Entry_B.ExistsSc(ItemCode: String): Boolean;
begin
Result := True;
ExecuteSql(AdoQry_Tmp,'select * from Sc_PriceMaster'
+' where ItemCode='+QuotedStr(ItemCode),0);
If AdoQry_Tmp.RecordCount = 0 then
Result := False;
ExecuteSql(AdoQry_Tmp,'select * from Sc_CostMaster'
+' where ItemCode='+QuotedStr(ItemCode),0);
If AdoQry_Tmp.RecordCount = 0 then
Result := False;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -