Visual Fox Pro 6.0 逻辑数据类型查询不起作用!

发布于 2024-11-13 05:24:38 字数 1258 浏览 6 评论 0原文

我当前的系统有一个生成税务报告的查询。问题是,有时进入我们系统的订单从未提交,但仍计入税务报告中。将订单设置为已提交的标志称为“完整”,并且将使用逻辑数据类型将其设置为 TRUE。

以下代码出现两个问题。首先,我用作约束“完整”的字段似乎是 FoxPro 保留函数,因为它在 FoxPro 中呈蓝色亮起。第二个问题是它不会排除那些从未提交的记录(基本上约束不起作用)。

编辑代码:

sele bkmast
set order to county
set filt to between(sysdate, m.ld_start, m.ld_end)
go top
m.lh_countylines = ''
select 000000.0000 as ordamt, import, county, 00000000.00 as amount, date() as start, date() as end dist;
    from bkmast ;
    where !empty(county) ;
    .and. alltrim(county) !='0' ;
    .and. alltrim(county) !='8.00_Wyoming' ;
    .and. alltrim(county) !='Select County' ;
    order by county ;
    into table countytax
m.ln_total=0
m.ln_countamt = 0
scan
    m.lc_county = alltrim(county)
    sele bkmast
    seek m.lc_county
    sum tax to m.ln_amt while county=m.lc_county
    seek m.lc_county            
    sum ordamt to m.ln_ordamt while county=m.lc_county 
    sele countytax
    replace ordamt with m.ln_ordamt
    replace amount with m.ln_amt
    replace startDate with m.ld_start
    replace endDate with m.ld_end
    m.ln_countamt = m.ln_countamt + ordamt
    m.ln_total = m.ln_total + amount
    m.lh_countylines = m.lh_countylines+elemerge(html_frm("TAXCOUNTY1"))
endscan

非常感谢任何帮助。

My current system has a query to generate a tax report. The problem is that sometimes orders go into our system that never get submitted but are still counted in the tax report. The flag that sets an order as submitted is called 'complete' and it will be set to TRUE using the logical datatype.

Two issues arise from the following code. First, it seems as though the field I am using as a constraint 'complete' is a FoxPro reserved function because it lights up in blue while in FoxPro. The second problem is that it will not exclude those records that never get submitted (basically the constraint is not working).

EDITED CODE:

sele bkmast
set order to county
set filt to between(sysdate, m.ld_start, m.ld_end)
go top
m.lh_countylines = ''
select 000000.0000 as ordamt, import, county, 00000000.00 as amount, date() as start, date() as end dist;
    from bkmast ;
    where !empty(county) ;
    .and. alltrim(county) !='0' ;
    .and. alltrim(county) !='8.00_Wyoming' ;
    .and. alltrim(county) !='Select County' ;
    order by county ;
    into table countytax
m.ln_total=0
m.ln_countamt = 0
scan
    m.lc_county = alltrim(county)
    sele bkmast
    seek m.lc_county
    sum tax to m.ln_amt while county=m.lc_county
    seek m.lc_county            
    sum ordamt to m.ln_ordamt while county=m.lc_county 
    sele countytax
    replace ordamt with m.ln_ordamt
    replace amount with m.ln_amt
    replace startDate with m.ld_start
    replace endDate with m.ld_end
    m.ln_countamt = m.ln_countamt + ordamt
    m.ln_total = m.ln_total + amount
    m.lh_countylines = m.lh_countylines+elemerge(html_frm("TAXCOUNTY1"))
endscan

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小忆控 2024-11-20 05:24:38

自 87 年 FoxBase 以来一直使用 Foxpro,我从来不知道“完整”命令,也没有直接记录在 VFP 帮助中(但如上所述,确实通过 Complete() 以蓝色突出显示作为函数调用)。另外.AND。是很久以前的旧查询指标。 “结束”虽然是一个关键字。我会尝试通过向查询添加别名并将 End 更改为 EndDate (并将 Start 与 StartDate 配对)来限定列,例如...

从您其他评论的结果中,我将直接在select 语句,然后进行更新...

SELECT 
      bk.Import,;
      bk.county,;
      sum( bk.OrdAmt ) AS OrdAmt,;
      sum( bk.Tax ) AS Amount,;
      m.ld_Start AS startDate,;
      m.ld_End AS endDate;
   FROM ;
      bkmast bk ;
   where ;
         sysdate between m.ld_start and m.ld_End;
     AND NOT empty( ALLTRIM( bk.county )) ;
     AND NOT alltrim( bk.county ) == '0' ;
     and NOT alltrim( bk.county ) == '8.00_Wyoming' ;
     and NOT alltrim( bk.county ) == 'Select County' ;
     AND bk.complete;
   group by ;
      bk.Import,;
      bk.county;
   order by;
      bk.county ;
   into;
      table countytax

在这种情况下,由于订单金额和税费的聚合,您不需要返回 BKMast 表...它已经完成...您可以循环遍历直接得到结果集。剩下的唯一一件事就是总结总税费和订单金额...如果这些变量未在您的 elemerge(html_frm("TAXCOUNTY1")) 调用中使用,您可以直接对它们进行预先求和

select CountyTax
sum OrdAmt, Amount to m.ln_CountAmt, m.ln_Total

scan
    */ These two already summed up from before the scan loop
    ** m.ln_countamt = m.ln_countamt + ordamt
    ** m.ln_total = m.ln_total + amount

    */ Now, continue with the eleMerge() function which will already have the
    */ values in the CountyTax table already summed up
    m.lc_county = alltrim(county)
    m.lh_countylines = m.lh_countylines+elemerge(html_frm("TAXCOUNTY1"))
endscan

Having worked with Foxpro since FoxBase back in '87, I've never known a "complete" command, nor is it directly documented in the VFP Help (yet as stated, DOES highlight in blue as a function call via Complete() ). Additionally the .AND. is long ago old indicator of query. The "End" though IS a keyword. I would try by qualifying the columns by adding the alias to the query and changing End to EndDate (and pairing up Start to StartDate), such as...

From the result of your other comment, I would do your pre-querying directly in the select statement, then do your updates...

SELECT 
      bk.Import,;
      bk.county,;
      sum( bk.OrdAmt ) AS OrdAmt,;
      sum( bk.Tax ) AS Amount,;
      m.ld_Start AS startDate,;
      m.ld_End AS endDate;
   FROM ;
      bkmast bk ;
   where ;
         sysdate between m.ld_start and m.ld_End;
     AND NOT empty( ALLTRIM( bk.county )) ;
     AND NOT alltrim( bk.county ) == '0' ;
     and NOT alltrim( bk.county ) == '8.00_Wyoming' ;
     and NOT alltrim( bk.county ) == 'Select County' ;
     AND bk.complete;
   group by ;
      bk.Import,;
      bk.county;
   order by;
      bk.county ;
   into;
      table countytax

In this case, since the aggregations of order amount and tax, you don't need to go back to the BKMast table... its already done... you can just cycle through the result set directly. The only thing left would be to sum up the total tax and order amounts... If those variables are not used within your elemerge(html_frm("TAXCOUNTY1")) call, you can just pre-sum those directly

select CountyTax
sum OrdAmt, Amount to m.ln_CountAmt, m.ln_Total

scan
    */ These two already summed up from before the scan loop
    ** m.ln_countamt = m.ln_countamt + ordamt
    ** m.ln_total = m.ln_total + amount

    */ Now, continue with the eleMerge() function which will already have the
    */ values in the CountyTax table already summed up
    m.lc_county = alltrim(county)
    m.lh_countylines = m.lh_countylines+elemerge(html_frm("TAXCOUNTY1"))
endscan
你在看孤独的风景 2024-11-20 05:24:38

如果您运行一个查询,其中 WHERE 子句中只有 this 是完整的,会发生什么:

SELECT ;
  000000.0000 OrdAmt,;
  bk.Import,;
  bk.county,;
  00000000.00 Amount,;
  date() as startDate,;
  date() as endDate;
from bkmast bk;
where bk.Complete ;
into cursor csrTest

这是否获得了正确的记录集?我的意思是,“完整”字段可能不包含您认为的内容。

添马舰

What happens if you run a query where the only this in the WHERE clause is complete:

SELECT ;
  000000.0000 OrdAmt,;
  bk.Import,;
  bk.county,;
  00000000.00 Amount,;
  date() as startDate,;
  date() as endDate;
from bkmast bk;
where bk.Complete ;
into cursor csrTest

Does that get the right set of records? What I'm getting at is that maybe the Complete field doesn't contain what you think it does.

Tamar

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文