如何在水晶报表中计算净收入

时间:2019-04-26 06:32:34

标签: c# vb.net crystal-reports sum

这样,有些情况我不了解,但是对于我在“公式”字段中用于计算净收入的公式, 我有一些Formulafield


报告标题部分


@totalpenjualanunit

if isnull ({viewlabarugi1.tanggal}) then
0
else
{viewlabarugi1.totalunit}

@totalpenjualanservicepart

if isnull({viewlabarugi1.tanggal})then 
0 
else 
{viewlabarugi1.totalserpart}

我试图计算净收入 例: 总销售量:691,618,736 我使用公式字段来计算总销售额(@totalpenjualan)

定义公式字段:

@totalpenjualan具有全局变量a

WhilePrintingRecords;
Global numberVar a:={@totalpenjualanunit} + {@totalpenjualanservicepart};

在我使用mysql中的数据库专家视图之前 名字是viewlabarugi

SELECT
    dbhistoryakun.tanggal,
    daftarlabadet.idakunlaba,
    daftarlaba.keterangan,
    daftarlabadet.noakun,
    daftarlabadet.keterangan AS keterangan_,
IF
    ( ISNULL( dbhistoryakun.debet ), 0, dbhistoryakun.debet ) AS debet,
IF
    ( ISNULL( dbhistoryakun.kredit ), 0, dbhistoryakun.kredit ) AS kredit,
    ( SELECT Sum( dbhistoryakun.kredit ) FROM dbhistoryakun WHERE dbhistoryakun.no_acc = '41.02.00' ) AS totalunit,
    ( SELECT sum( dbhistoryakun.kredit ) FROM dbhistoryakun WHERE dbhistoryakun.no_acc = '41.04.00' OR dbhistoryakun.no_acc = '41.03.00' ) AS totalserpart 
FROM
    daftarlaba
    INNER JOIN daftarlabadet ON daftarlabadet.idakunlaba = daftarlaba.idakunlaba
    LEFT JOIN dbhistoryakun ON dbhistoryakun.no_acc = daftarlabadet.noakun 
GROUP BY
    dbhistoryakun.tanggal,
    daftarlabadet.idakunlaba,
    daftarlaba.keterangan,
    daftarlabadet.noakun,
    daftarlabadet.keterangan,
    dbhistoryakun.debet 
ORDER BY
    daftarlaba.idakunlaba ASC,
    daftarlabadet.noakun ASC

我有一个基于viewlabarugi1.idakunlaba的分组部分


部分详细信息


在本节中基于分组的详细信息 我使用Formulafield(@total)来计算借方价值和贷方价值

@总计

{viewlabarugi1.debet} - {viewlabarugi1.kredit}

组页脚部分


在组页脚部分,我将公式字段(@totalgroup)用于求和公式字段(@total) 按组计算明细部分的总数

@totalgroup:


WhilePrintingRecords;
Global numberVar l:=Sum ({@total},{viewlabarugi1.idakunlaba});
Global numberVar u:=Sum ({@total},{viewlabarugi1.idakunlaba})*-1;

iif({viewlabarugi1.idakunlaba} ='04',l, abs(u))

报告页脚部分


i使用公式字段(@lababersih) 计算总净收入,

@lababersih:

WhilePrintingRecords;
Global numberVar a;
Global numberVar l;
Global numberVar u;
Global numberVar s :=0;
Global numberVar z :=  iif({viewlabarugi1.idakunlaba}='04',l,u);
if {viewlabarugi1.idakunlaba} <> '0' then
s :=  a + z;

Top Report

Bottom Report

Report Preview TOP

Grouping with idakunlaba

Issue Image

纯收入@totalpenjualan-总组 {viewlabarugi1.idakunlaba} ='04'时出现的问题 它是从@totalgroup加起来的 我希望公式字段为@lababersih

的输出

@totalpenjualan                                  = 691.618.736

@totalgroup when {viewlabarugi1.idakunlaba}= '01'=     200.000 

@totalgroup when {viewlabarugi1.idakunlaba}= '02'=      18.000 

@totalgroup when {viewlabarugi1.idakunlaba}= '03'=           0

@totalgroup when {viewlabarugi1.idakunlaba}= '04'=     300.000 added up

_______________________________________________________________

                                         Output  = 691.700.736
```
thank you and please help 

sorry my english is bad

0 个答案:

没有答案