Ejemplo n.º 1
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jenis Pengeluaran"
            });

            GridListControlHelper.InitializeGridListControl <JenisPengeluaran>(this.gridList, _listOfJenisPengeluaran, gridListProperties);

            if (_listOfJenisPengeluaran.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfJenisPengeluaran.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfJenisPengeluaran.Count)
                        {
                            var jenisPengeluaran = _listOfJenisPengeluaran[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = jenisPengeluaran.nama_jenis_pengeluaran;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama", Width = 200
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jabatan", Width = 200
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kehadiran", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Absen", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Gaji", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tunjangan", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Bonus", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Lembur", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Potongan", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Total"
            });

            GridListControlHelper.InitializeGridListControl <GajiKaryawan>(this.gridList, _listOfGaji, gridListProperties);

            if (_listOfGaji.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfGaji.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfGaji.Count)
                        {
                            var gaji = _listOfGaji[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(gaji.tanggal);
                                break;

                            case 3:
                                var karyawan = gaji.Karyawan;
                                if (karyawan != null)
                                {
                                    e.Style.CellValue = karyawan.nama_karyawan;
                                }

                                break;

                            case 4:
                                var jabatan = gaji.Karyawan.Jabatan;

                                if (jabatan != null)
                                {
                                    e.Style.CellValue = jabatan.nama_jabatan;
                                }

                                break;

                            case 5:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = gaji.kehadiran;
                                break;

                            case 6:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = gaji.absen;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.gaji_akhir);

                                break;

                            case 8:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.tunjangan);

                                break;

                            case 9:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.bonus);

                                break;

                            case 10:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.lembur_akhir);

                                break;

                            case 11:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.potongan);

                                break;

                            case 12:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(gaji.total_gaji);

                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
        private void InitGridControl(GridControl grid)
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jenis Pengeluaran", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sub Total", Width = 110
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Aksi"
            });

            GridListControlHelper.InitializeGridListControl <ItemPengeluaranBiaya>(grid, _listOfItemPengeluaran, gridListProperties);

            grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.ColIndex == 6)
                {
                    if (grid.RowCount == 1)
                    {
                        MsgHelper.MsgWarning("Minimal 1 item pengeluaran harus diinputkan !");
                        return;
                    }

                    if (MsgHelper.MsgDelete())
                    {
                        var itemPengeluaran = _listOfItemPengeluaran[e.RowIndex - 1];
                        itemPengeluaran.entity_state = EntityState.Deleted;

                        _listOfItemPengeluaranDeleted.Add(itemPengeluaran);
                        _listOfItemPengeluaran.Remove(itemPengeluaran);

                        grid.RowCount = _listOfItemPengeluaran.Count();
                        grid.Refresh();

                        RefreshTotal();
                    }
                }
            };

            grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                // Make sure the cell falls inside the grid
                if (e.RowIndex > 0)
                {
                    if (!(_listOfItemPengeluaran.Count > 0))
                    {
                        return;
                    }

                    var itemPengeluaran  = _listOfItemPengeluaran[e.RowIndex - 1];
                    var jenisPengeluaran = itemPengeluaran.JenisPengeluaran;

                    if (e.RowIndex % 2 == 0)
                    {
                        e.Style.BackColor = ColorCollection.BACK_COLOR_ALTERNATE;
                    }

                    switch (e.ColIndex)
                    {
                    case 1:     // no urut
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.Enabled             = false;
                        e.Style.CellValue           = e.RowIndex.ToString();
                        break;

                    case 2:     // nama jenis pengeluaran
                        if (jenisPengeluaran != null)
                        {
                            e.Style.CellValue = jenisPengeluaran.nama_jenis_pengeluaran;
                        }

                        break;

                    case 3:     // jumlah
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellValue           = itemPengeluaran.jumlah;

                        break;

                    case 4:     // harga
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                        e.Style.CellValue           = NumberHelper.NumberToString(itemPengeluaran.harga);

                        break;

                    case 5:     // subtotal
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                        e.Style.Enabled             = false;
                        e.Style.CellValue           = NumberHelper.NumberToString(itemPengeluaran.jumlah * itemPengeluaran.harga);
                        break;

                    case 6:     // button hapus
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellType            = GridCellTypeName.PushButton;
                        e.Style.Enabled             = true;
                        e.Style.Description         = "Hapus";
                        break;

                    default:
                        break;
                    }

                    e.Handled = true; // we handled it, let the grid know
                }
            };

            var colIndex = 2; // kolom nama produk

            grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate);
        }
Ejemplo n.º 4
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Alamat", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Telepon", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jenis Gajian", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Status", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jabatan", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Kasbon"
            });

            GridListControlHelper.InitializeGridListControl <Karyawan>(this.gridList, _listOfKaryawan, gridListProperties);

            if (_listOfKaryawan.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfKaryawan.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfKaryawan.Count)
                        {
                            var karyawan = _listOfKaryawan[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = karyawan.nama_karyawan;
                                break;

                            case 3:
                                e.Style.CellValue = karyawan.alamat;
                                break;

                            case 4:
                                e.Style.CellValue = karyawan.telepon;
                                break;

                            case 5:
                                e.Style.CellValue = karyawan.jenis_gajian == JenisGajian.Mingguan ? "Mingguan" : "Bulanan";
                                break;

                            case 6:
                                e.Style.CellValue           = karyawan.is_active ? "Aktif" : "Non Aktif";
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 7:
                                var jabatan = karyawan.Jabatan;

                                if (jabatan != null)
                                {
                                    e.Style.CellValue = jabatan.nama_jabatan;
                                }

                                break;

                            case 8:
                                e.Style.CellValue           = NumberHelper.NumberToString(karyawan.sisa_kasbon);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 5
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kurir", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jenis Layanan", Width = 330
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tarif"
            });

            GridListControlHelper.InitializeGridListControl <costs>(this.gridList, _listOfCost, gridListProperties);

            if (_listOfCost.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfCost.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfCost.Count)
                        {
                            var cost = _listOfCost[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = cost.kurir_code;
                                break;

                            case 3:
                                e.Style.CellValue = string.Format("{0} ({1})", cost.service, cost.description);
                                break;

                            case 4:
                                var costDetail = cost.cost[0];
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(costDetail.value);
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 6
0
        private void InitGridControl(GridControl grid)
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Produk", Width = 120
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama Produk", Width = 240
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sub Total", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Aksi"
            });

            GridListControlHelper.InitializeGridListControl <ItemJualProduk>(grid, _listOfItemJual, gridListProperties);

            grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.ColIndex == 8)
                {
                    if (grid.RowCount == 1)
                    {
                        MsgHelper.MsgWarning("Minimal 1 item produk harus diinputkan !");
                        return;
                    }

                    if (MsgHelper.MsgDelete())
                    {
                        var itemJual = _listOfItemJual[e.RowIndex - 1];
                        itemJual.entity_state = EntityState.Deleted;

                        _listOfItemJualDeleted.Add(itemJual);
                        _listOfItemJual.Remove(itemJual);

                        grid.RowCount = _listOfItemJual.Count();
                        grid.Refresh();

                        RefreshTotal();
                    }
                }
            };

            grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                // Make sure the cell falls inside the grid
                if (e.RowIndex > 0)
                {
                    if (!(_listOfItemJual.Count > 0))
                    {
                        return;
                    }

                    var itemJual = _listOfItemJual[e.RowIndex - 1];
                    var produk   = itemJual.Produk;

                    if (e.RowIndex % 2 == 0)
                    {
                        e.Style.BackColor = ColorCollection.BACK_COLOR_ALTERNATE;
                    }

                    double hargaBeli = 0;
                    double hargaJual = 0;
                    double jumlah    = 0;

                    var isRetur = itemJual.jumlah_retur > 0;
                    if (isRetur)
                    {
                        e.Style.BackColor = Color.Red;
                        e.Style.Enabled   = false;
                    }

                    switch (e.ColIndex)
                    {
                    case 1:     // no urut
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.Enabled             = false;
                        e.Style.CellValue           = e.RowIndex.ToString();
                        break;

                    case 2:
                        if (produk != null)
                        {
                            e.Style.CellValue = produk.kode_produk;
                        }

                        break;

                    case 3:     // nama produk
                        if (produk != null)
                        {
                            e.Style.CellValue = produk.nama_produk;
                        }

                        break;

                    case 4:     // jumlah
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellValue           = itemJual.jumlah - itemJual.jumlah_retur;

                        break;

                    case 5:     // diskon
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellValue           = itemJual.diskon;

                        break;

                    case 6:     // harga
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;

                        hargaBeli = itemJual.harga_beli;
                        hargaJual = itemJual.harga_jual;

                        if (produk != null)
                        {
                            if (!(hargaBeli > 0))
                            {
                                hargaBeli = produk.harga_beli;
                            }

                            if (!(hargaJual > 0))
                            {
                                hargaJual = produk.harga_jual;
                            }
                        }

                        e.Style.CellValue = NumberHelper.NumberToString(hargaJual);

                        break;

                    case 7:     // subtotal
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                        e.Style.Enabled             = false;

                        jumlah = itemJual.jumlah - itemJual.jumlah_retur;

                        hargaBeli = itemJual.harga_beli;
                        hargaJual = itemJual.harga_setelah_diskon;

                        if (produk != null)
                        {
                            if (!(hargaBeli > 0))
                            {
                                hargaBeli = produk.harga_beli;
                            }

                            if (!(hargaJual > 0))
                            {
                                double diskon       = itemJual.diskon;
                                double diskonRupiah = 0;

                                if (!(diskon > 0))
                                {
                                    diskon = produk.diskon > 0 ? produk.diskon : produk.Golongan.diskon;
                                }

                                diskonRupiah = diskon / 100 * produk.harga_jual;
                                hargaJual    = produk.harga_jual - diskonRupiah;
                            }
                        }

                        e.Style.CellValue = NumberHelper.NumberToString(jumlah * hargaJual);
                        break;

                    case 8:     // button hapus
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellType            = GridCellTypeName.PushButton;
                        e.Style.Description         = "Hapus";
                        break;

                    default:
                        break;
                    }

                    e.Handled = true; // we handled it, let the grid know
                }
            };

            var colIndex = 2; // kolom nama produk

            grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate);
        }
Ejemplo n.º 7
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Produk", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Penambahan", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Penambahan", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pengurangan", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pengurangan", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Alasan Penyesuaian", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan"
            });

            GridListControlHelper.InitializeGridListControl <PenyesuaianStok>(this.gridList, _listOfPenyesuaianStok, gridListProperties, false, additionalRowCount: 1);
            this.gridList.Grid.Model.RowHeights[1]    = 25;
            this.gridList.Grid.Model.Rows.FrozenCount = 1;

            this.gridList.Grid.PrepareViewStyleInfo += delegate(object sender, GridPrepareViewStyleInfoEventArgs e)
            {
                var subHeaderHargaJual = new string[] { "Stok Etalase", "Stok Gudang", "Stok Etalase", "Stok Gudang" };
                if (e.ColIndex > 3 && e.RowIndex == 1)
                {
                    var colIndex = 4;

                    foreach (var header in subHeaderHargaJual)
                    {
                        if (colIndex == e.ColIndex)
                        {
                            e.Style.Text = header;
                        }

                        colIndex++;
                    }
                }
            };

            if (_listOfPenyesuaianStok.Count > 0)
            {
                this.gridList.SetSelected(1, true);
            }

            // merge cell
            var column = 1; // kolom no

            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 2; // tanggal
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 3; // produk
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 4; // kolom penambahan stok etalase dan gudang
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 0, column + 1));

            column = 6; // kolom pengurangan stok etalase dan gudang
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 0, column + 1));

            column = 8; // alasan penyesuaian
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 9; // keterangan
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            var headerStyle = this.gridList.Grid.BaseStylesMap["Column Header"].StyleInfo;

            headerStyle.CellType = GridCellTypeName.Header;

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (e.RowIndex == 1)
                {
                    if (e.ColIndex > 3)
                    {
                        e.Style.ModifyStyle(headerStyle, StyleModifyType.ApplyNew);
                    }

                    // we handled it, let the grid know
                    e.Handled = true;
                }

                if (_listOfPenyesuaianStok.Count > 0)
                {
                    if (e.RowIndex > 1)
                    {
                        var rowIndex = e.RowIndex - 2;

                        if (rowIndex < _listOfPenyesuaianStok.Count)
                        {
                            var penyesuaianStok = _listOfPenyesuaianStok[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 1:
                                e.Style.CellValue           = e.RowIndex - 1;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(penyesuaianStok.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = penyesuaianStok.Produk.nama_produk;
                                break;

                            case 4:
                                e.Style.CellValue           = penyesuaianStok.penambahan_stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 5:
                                e.Style.CellValue           = penyesuaianStok.penambahan_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 6:
                                e.Style.CellValue           = penyesuaianStok.pengurangan_stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 7:
                                e.Style.CellValue           = penyesuaianStok.pengurangan_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 8:
                                e.Style.CellValue = penyesuaianStok.AlasanPenyesuaianStok.alasan;
                                break;

                            case 9:
                                e.Style.CellValue = penyesuaianStok.keterangan;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 8
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Alamat", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kontak", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Telepon", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Hutang", Width = 100
            });

            GridListControlHelper.InitializeGridListControl <Supplier>(this.gridList, _listOfSupplier, gridListProperties);

            if (_listOfSupplier.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfSupplier.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfSupplier.Count)
                        {
                            var supplier = _listOfSupplier[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = supplier.nama_supplier;
                                break;

                            case 3:
                                e.Style.CellValue = supplier.alamat;
                                break;

                            case 4:
                                e.Style.CellValue = supplier.kontak;
                                break;

                            case 5:
                                e.Style.CellValue = supplier.telepon;
                                break;

                            case 6:
                                e.Style.CellValue           = NumberHelper.NumberToString(supplier.total_hutang - supplier.total_pembayaran_hutang);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 9
0
        private void InitGridListHistoriPembayaran()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan"
            });

            GridListControlHelper.InitializeGridListControl <PembayaranKasbon>(this.gridListHistoriPembayaran, _listOfHistoriPembayaranKasbon, gridListProperties);

            if (_listOfHistoriPembayaranKasbon.Count > 0)
            {
                this.gridListHistoriPembayaran.SetSelected(0, true);
            }

            this.gridListHistoriPembayaran.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfHistoriPembayaranKasbon.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfHistoriPembayaranKasbon.Count)
                        {
                            var pembayaranKasbon = _listOfHistoriPembayaranKasbon[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(pembayaranKasbon.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = pembayaranKasbon.nota;
                                break;

                            case 4:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(pembayaranKasbon.nominal);
                                break;

                            case 5:
                                e.Style.CellValue = pembayaranKasbon.keterangan;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };

            this.gridListHistoriPembayaran.SelectedValueChanged += delegate(object sender, EventArgs e)
            {
                GridListHistoriPembayaranHandleSelectionChanged((GridListControl)sender);
            };

            this.gridListHistoriPembayaran.DoubleClick += delegate(object sender, EventArgs e)
            {
                if (btnPerbaikiPembayaran.Enabled)
                {
                    btnPerbaikiPembayaran_Click(sender, e);
                }
            };
        }
Ejemplo n.º 10
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tempo", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Supplier", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Hutang", Width = 140
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Hutang", Width = 140
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Histori Pembayaran"
            });

            GridListControlHelper.InitializeGridListControl <BeliProduk>(this.gridList, _listOfBeli, gridListProperties, false);

            if (_listOfBeli.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.RowIndex > 0)
                {
                    var index = e.RowIndex - 1;

                    switch (e.ColIndex)
                    {
                    case 9:     // histori pembayaran
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var beli = _listOfBeli[index];

                            IPembayaranHutangProdukBll bll = new PembayaranHutangProdukBll(_log);
                            var listOfHistoriPembayaran    = bll.GetHistoriPembayaran(beli.beli_produk_id);

                            if (listOfHistoriPembayaran.Count > 0)
                            {
                                var frmHistoriPembayaran = new FrmLookupHistoriPembayaran("Histori Pembayaran Hutang", beli, listOfHistoriPembayaran);
                                frmHistoriPembayaran.ShowDialog();
                            }
                            else
                            {
                                MsgHelper.MsgInfo("Belum ada informasi histori pembayaran");
                            }
                        }

                        break;

                    default:
                        break;
                    }
                }
            };

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfBeli.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfBeli.Count)
                        {
                            double totalNota = 0;

                            var beli = _listOfBeli[rowIndex];
                            if (beli != null)
                            {
                                totalNota = beli.grand_total;
                            }


                            var isRetur = beli.retur_beli_produk_id != null;

                            if (isRetur)
                            {
                                e.Style.BackColor = Color.Red;
                            }

                            switch (e.ColIndex)
                            {
                            case 1:
                                var noUrut = (_pageNumber - 1) * _pageSize + e.RowIndex;
                                e.Style.CellValue           = noUrut;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(beli.tanggal);
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(beli.tanggal_tempo);
                                break;

                            case 4:
                                e.Style.CellValue = beli.nota;
                                break;

                            case 5:
                                if (beli.Supplier != null)
                                {
                                    e.Style.CellValue = beli.Supplier.nama_supplier;
                                }

                                break;

                            case 6:
                                e.Style.CellValue = beli.keterangan;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota);
                                break;

                            case 8:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota - beli.total_pelunasan);
                                break;

                            case 9:     // button history pembayaran
                                e.Style.Enabled             = beli.tanggal_tempo != null;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellType            = GridCellTypeName.PushButton;
                                e.Style.Description         = "Cek Histori";

                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tempo", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Customer", Width = _pengaturanUmum.jenis_printer == JenisPrinter.InkJet ? 180 : 260
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Piutang", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Piutang", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Histori Pembayaran", Width = 80
            });

            if (_pengaturanUmum.jenis_printer == JenisPrinter.InkJet)
            {
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Cetak Nota/Label", Width = 80
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = ""
                });
            }
            else
            {
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Cetak Nota", Width = 80
                });
            }

            GridListControlHelper.InitializeGridListControl <JualProduk>(this.gridList, _listOfJual, gridListProperties, false, rowHeight: 40);

            if (_pengaturanUmum.jenis_printer == JenisPrinter.InkJet)
            {
                // merge header kolom cetak nota/label
                this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, 10, 0, 11));
            }

            if (_listOfJual.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.RowIndex > 0)
                {
                    var index = e.RowIndex - 1;

                    switch (e.ColIndex)
                    {
                    case 9:     // histori pembayaran
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var jual = _listOfJual[index];

                            IPembayaranPiutangProdukBll bll = new PembayaranPiutangProdukBll(_log);
                            var listOfHistoriPembayaran     = bll.GetHistoriPembayaran(jual.jual_id);

                            if (listOfHistoriPembayaran.Count > 0)
                            {
                                var frmHistoriPembayaran = new FrmLookupHistoriPembayaran("Histori Pembayaran Piutang", jual, listOfHistoriPembayaran);
                                frmHistoriPembayaran.ShowDialog();
                            }
                            else
                            {
                                MsgHelper.MsgInfo("Belum ada informasi histori pembayaran");
                            }
                        }

                        break;

                    case 10:     // cetak nota jual
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var jual = _listOfJual[index];

                            switch (this._pengaturanUmum.jenis_printer)
                            {
                            case JenisPrinter.DotMatrix:
                                if (MsgHelper.MsgKonfirmasi("Apakah proses pencetakan ingin dilanjutkan ?"))
                                {
                                    CetakNotaDotMatrix(jual);
                                }
                                break;

                            case JenisPrinter.MiniPOS:
                                if (MsgHelper.MsgKonfirmasi("Apakah proses pencetakan ingin dilanjutkan ?"))
                                {
                                    CetakNotaMiniPOS(jual);
                                }
                                break;

                            default:
                                var frmCetakNota = new FrmPreviewNotaPenjualan("Preview Nota Penjualan", jual);
                                frmCetakNota.ShowDialog();
                                break;
                            }
                        }

                        break;

                    case 11:     // cetak label nota jual
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var jual = _listOfJual[index];

                            var frmCetakLabelNota = new FrmPreviewLabelNotaPenjualan("Preview Label Nota Penjualan", jual);
                            frmCetakLabelNota.ShowDialog();
                        }

                        break;

                    default:
                        break;
                    }
                }
            };

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfJual.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfJual.Count)
                        {
                            double totalNota = 0;

                            var jual = _listOfJual[rowIndex];
                            if (jual != null)
                            {
                                totalNota = jual.grand_total;
                            }


                            var isRetur           = jual.retur_jual_id != null;
                            var oldStyleBackColor = e.Style.BackColor;

                            if (isRetur)
                            {
                                e.Style.BackColor = Color.Red;
                            }

                            switch (e.ColIndex)
                            {
                            case 1:
                                var noUrut = (_pageNumber - 1) * _pageSize + e.RowIndex;
                                e.Style.CellValue           = noUrut;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal);
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal_tempo);
                                break;

                            case 4:
                                e.Style.CellValue = jual.nota;
                                break;

                            case 5:
                                if (jual.Customer != null)
                                {
                                    SetWilayahCustomer(jual.Customer);
                                    e.Style.CellValue = jual.Customer.nama_customer;
                                }

                                break;

                            case 6:
                                e.Style.CellValue = jual.keterangan;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota);
                                break;

                            case 8:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota - jual.total_pelunasan);
                                break;

                            case 9:     // button history pembayaran
                                e.Style.Enabled             = jual.tanggal_tempo != null;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellType            = GridCellTypeName.PushButton;
                                e.Style.BackColor           = oldStyleBackColor;
                                e.Style.Description         = "Cek Histori";

                                break;

                            case 10:     // button cetak nota
                                e.Style.Enabled             = jual.Customer != null;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellType            = GridCellTypeName.PushButton;
                                e.Style.BackColor           = oldStyleBackColor;
                                e.Style.Description         = "Cetak Nota";
                                break;

                            case 11:     // button cetak label nota
                                if (_pengaturanUmum.jenis_printer == JenisPrinter.InkJet)
                                {
                                    e.Style.Enabled             = jual.Customer != null;
                                    e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                    e.Style.CellType            = GridCellTypeName.PushButton;
                                    e.Style.BackColor           = oldStyleBackColor;
                                    e.Style.Description         = "Cetak Label Nota";
                                }

                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 12
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Produk", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama Produk", Width = 540
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Satuan", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Beli", Width = 110
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Jual", Width = 110
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Stok Etalase", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Stok Gudang", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Min. Stok Gudang", Width = 110
            });

            GridListControlHelper.InitializeGridListControl <Produk>(this.gridList, _listOfProduk, gridListProperties);

            if (_listOfProduk.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfProduk.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfProduk.Count)
                        {
                            var produk = _listOfProduk[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = produk.kode_produk;
                                break;

                            case 3:
                                e.Style.CellValue = produk.nama_produk;
                                break;

                            case 4:
                                var satuan = string.Empty;

                                if (produk.satuan.Length > 0)
                                {
                                    satuan = produk.satuan;
                                }

                                e.Style.CellValue = satuan;
                                break;

                            case 5:
                                e.Style.CellValue           = NumberHelper.NumberToString(produk.harga_beli);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 6:
                                e.Style.CellValue           = NumberHelper.NumberToString(produk.harga_jual);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 7:
                                e.Style.CellValue           = produk.stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 8:
                                e.Style.CellValue           = produk.stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 9:
                                e.Style.CellValue           = produk.minimal_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 13
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 80, HorizontalAlignment = GridHorizontalAlignment.Center
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tempo", Width = 80, HorizontalAlignment = GridHorizontalAlignment.Center
            });

            if (this._referensiType == ReferencesType.NotaJualProduk)
            {
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nota Jual", Width = 90, HorizontalAlignment = GridHorizontalAlignment.Center
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Customer", Width = 170
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Sisa Piutang", HorizontalAlignment = GridHorizontalAlignment.Right
                });
            }
            else
            {
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nota Beli", Width = 90, HorizontalAlignment = GridHorizontalAlignment.Center
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Supplier", Width = 170
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Sisa Hutang", HorizontalAlignment = GridHorizontalAlignment.Right
                });
            }

            var listCount = 0;

            switch (this._referensiType)
            {
            case ReferencesType.NotaBeliProduk:
                GridListControlHelper.InitializeGridListControl <BeliProduk>(this.gridList, _listOfNotaBeliProduk, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridNotaBeliProduk_QueryCellInfo;

                listCount = _listOfNotaBeliProduk.Count;

                break;

            case ReferencesType.NotaJualProduk:
                GridListControlHelper.InitializeGridListControl <JualProduk>(this.gridList, _listOfNotaJualProduk, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridNotaJualProduk_QueryCellInfo;

                listCount = _listOfNotaJualProduk.Count;

                break;

            default:
                break;
            }

            if (listCount > 0)
            {
                this.gridList.SetSelected(0, true);
            }
        }
Ejemplo n.º 14
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();


            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Produk", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama Produk", Width = 270
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga", Width = 75
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sub Total", Width = 100
            });

            var listOfItemJual = _jual.item_jual;

            GridListControlHelper.InitializeGridListControl <ItemJualProduk>(this.gridList, listOfItemJual, gridListProperties);

            if (listOfItemJual.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (listOfItemJual.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < listOfItemJual.Count)
                        {
                            var itemJual = listOfItemJual[rowIndex];
                            var produk   = itemJual.Produk;

                            switch (e.ColIndex)
                            {
                            case 2:
                                if (produk != null)
                                {
                                    e.Style.CellValue = produk.kode_produk;
                                }

                                break;

                            case 3:     // nama produk
                                if (produk != null)
                                {
                                    e.Style.CellValue = produk.nama_produk;
                                }

                                break;

                            case 4:     // jumlah
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = itemJual.jumlah - itemJual.jumlah_retur;

                                break;

                            case 5:     // diskon
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = itemJual.diskon;

                                break;

                            case 6:     // harga
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(itemJual.harga_jual);

                                break;

                            case 7:     // subtotal
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;

                                var jumlah = itemJual.jumlah - itemJual.jumlah_retur;
                                e.Style.CellValue = NumberHelper.NumberToString(jumlah * itemJual.harga_setelah_diskon);
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 15
0
        private void InitGrid()
        {
            var glProp = new List <GridListControlProperties>();

            glProp.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            glProp.Add(new GridListControlProperties {
                Header = "User Name", Width = 300
            });
            glProp.Add(new GridListControlProperties {
                Header = "First Name", Width = 300
            });
            glProp.Add(new GridListControlProperties {
                Header = "Last Name", Width = 300
            });
            glProp.Add(new GridListControlProperties {
                Header = "Roles", Width = 200
            });


            GridListControlHelper.InitializeGridListControl <User>(grdLstUser, _lstUser, glProp);

            if (_lstUser.Count > 0)
            {
                this.grdLstUser.SetSelected(0, true);
            }

            grdLstUser.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_lstUser.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;
                        if (rowIndex < _lstUser.Count)
                        {
                            var users = _lstUser[rowIndex];
                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = users.userId;
                                break;

                            case 3:
                                e.Style.CellValue = users.firstName;
                                break;

                            case 4:
                                e.Style.CellValue = users.lastName;
                                break;

                            case 5:
                                e.Style.CellValue = users.roles;
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            };
        }
Ejemplo n.º 16
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tempo", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Customer", Width = 230
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Piutang", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Piutang", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Cetak Nota/Label", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = ""
            });

            GridListControlHelper.InitializeGridListControl <JualProduk>(this.gridList, _listOfJual, gridListProperties);

            // merge header kolom cetak nota/label
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, 9, 0, 10));

            if (_listOfJual.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.RowIndex > 0)
                {
                    var index = e.RowIndex - 1;

                    switch (e.ColIndex)
                    {
                    case 9:     // cetak nota jual
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var jual = _listOfJual[index];

                            if (this._pengaturanUmum.is_printer_mini_pos)
                            {
                                if (MsgHelper.MsgKonfirmasi("Apakah proses pencetakan ingin dilanjutkan ?"))
                                {
                                    CetakNotaMiniPOS(jual);
                                }
                            }
                            else
                            {
                                var frmCetakNota = new FrmPreviewNotaPenjualan("Preview Nota Penjualan", jual);
                                frmCetakNota.ShowDialog();
                            }
                        }

                        break;

                    case 10:     // cetak label nota jual
                        using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                        {
                            var jual = _listOfJual[index];

                            var frmCetakLabelNota = new FrmPreviewLabelNotaPenjualan("Preview Label Nota Penjualan", jual);
                            frmCetakLabelNota.ShowDialog();
                        }

                        break;

                    default:
                        break;
                    }
                }
            };

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfJual.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfJual.Count)
                        {
                            double totalNota = 0;

                            var jual = _listOfJual[rowIndex];
                            if (jual != null)
                            {
                                totalNota = jual.grand_total;
                            }


                            var isRetur           = jual.retur_jual_id != null;
                            var oldStyleBackColor = e.Style.BackColor;

                            if (isRetur)
                            {
                                e.Style.BackColor = Color.Red;
                            }

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal);
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal_tempo);
                                break;

                            case 4:
                                e.Style.CellValue = jual.nota;
                                break;

                            case 5:
                                if (jual.Customer != null)
                                {
                                    e.Style.CellValue = jual.Customer.nama_customer;
                                }

                                break;

                            case 6:
                                e.Style.CellValue = jual.keterangan;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota);
                                break;

                            case 8:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota - jual.total_pelunasan);
                                break;

                            case 9:     // button hapus
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellType            = GridCellTypeName.PushButton;
                                e.Style.BackColor           = oldStyleBackColor;
                                e.Style.Description         = "Cetak Nota";
                                break;

                            case 10:     // button hapus
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellType            = GridCellTypeName.PushButton;
                                e.Style.BackColor           = oldStyleBackColor;
                                e.Style.Description         = "Cetak Label Nota";
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 17
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });

            var listCount = 0;

            switch (this._referensiType)
            {
            case ReferencesType.Customer:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Customer", Width = 200
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Customer>(this.gridList, _listOfCustomer, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridCustomer_QueryCellInfo;

                listCount = _listOfCustomer.Count;

                break;

            case ReferencesType.Supplier:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Supplier", Width = 200
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Supplier>(this.gridList, _listOfSupplier, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridSupplier_QueryCellInfo;

                listCount = _listOfSupplier.Count;
                break;

            case ReferencesType.Produk:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kode Produk", Width = 120
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Produk"
                });
                GridListControlHelper.InitializeGridListControl <Produk>(this.gridList, _listOfProduk, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridProduk_QueryCellInfo;

                listCount = _listOfProduk.Count;
                break;

            default:
                break;
            }

            if (listCount > 0)
            {
                this.gridList.SetSelected(0, true);
            }
        }
Ejemplo n.º 18
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 90
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Karyawan", Width = 230
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan"
            });

            GridListControlHelper.InitializeGridListControl <Kasbon>(this.gridList, _listOfKasbon, gridListProperties);

            if (_listOfKasbon.Count > 0)
            {
                this.gridList.SetSelected(0, true);
                GridListHandleSelectionChanged(this.gridList);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfKasbon.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfKasbon.Count)
                        {
                            var kasbon = _listOfKasbon[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(kasbon.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = kasbon.nota;
                                break;

                            case 4:
                                var karyawan = kasbon.Karyawan;
                                if (karyawan != null)
                                {
                                    e.Style.CellValue = kasbon.Karyawan.nama_karyawan;
                                }

                                break;

                            case 5:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(kasbon.nominal);
                                break;

                            case 6:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(kasbon.sisa);
                                break;

                            case 7:
                                e.Style.CellValue = kasbon.keterangan;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };

            this.gridList.SelectedValueChanged += delegate(object sender, EventArgs e)
            {
                GridListHandleSelectionChanged((GridListControl)sender);
            };
        }
Ejemplo n.º 19
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 50
            });

            var listCount = 0;

            this.gridList.Grid.QueryRowHeight += delegate(object sender, GridRowColSizeEventArgs e)
            {
                e.Size    = 27;
                e.Handled = true;
            };

            switch (this._referensiType)
            {
            case ReferencesType.Customer:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Customer", Width = 400
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Customer>(this.gridList, _listOfCustomer, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridCustomer_QueryCellInfo;

                listCount = _listOfCustomer.Count;

                break;

            case ReferencesType.Produk:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kode Produk", Width = 150
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Produk", Width = 400
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Harga", Width = 120
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Stok", Width = 70
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Golongan"
                });
                GridListControlHelper.InitializeGridListControl <Produk>(this.gridList, _listOfProduk, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridProduk_QueryCellInfo;

                listCount = _listOfProduk.Count;
                break;

            default:
                break;
            }

            if (listCount > 0)
            {
                this.gridList.SetSelected(0, true);
            }
        }
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota Retur", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota Jual", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Customer", Width = 400
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 500
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Total", Width = 150
            });

            GridListControlHelper.InitializeGridListControl <ReturJualProduk>(this.gridList, _listOfRetur, gridListProperties);

            if (_listOfRetur.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfRetur.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfRetur.Count)
                        {
                            double totalNota = 0;

                            var retur = _listOfRetur[rowIndex];

                            if (retur != null)
                            {
                                totalNota = retur.total_nota;
                            }

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(retur.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = retur.nota;
                                break;

                            case 4:
                                var jual = retur.JualProduk;
                                if (jual != null)
                                {
                                    e.Style.CellValue = jual.nota;
                                }

                                break;

                            case 5:
                                if (retur.Customer != null)
                                {
                                    e.Style.CellValue = retur.Customer.nama_customer;
                                }

                                break;

                            case 6:
                                e.Style.CellValue = retur.keterangan;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota);
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 21
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama", Width = 150
            });

            gridListProperties.Add(new GridListControlProperties {
                Header = "Provinsi", Width = 120
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kabupaten", Width = 140
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kecamatan", Width = 140
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Alamat", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Pos", Width = 70
            });

            gridListProperties.Add(new GridListControlProperties {
                Header = "Kontak", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Telepon", Width = 100
            });

            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Plafon Piutang", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Piutang"
            });

            GridListControlHelper.InitializeGridListControl <Customer>(this.gridList, _listOfCustomer, gridListProperties);

            if (_listOfCustomer.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfCustomer.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfCustomer.Count)
                        {
                            var customer = _listOfCustomer[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = customer.nama_customer;
                                break;

                            case 3:
                                e.Style.CellValue = customer.Provinsi != null ? customer.Provinsi.nama_provinsi : string.Empty;
                                break;

                            case 4:
                                e.Style.CellValue = customer.Kabupaten != null ? customer.Kabupaten.nama_kabupaten : customer.kabupaten_old.NullToString();
                                break;

                            case 5:
                                e.Style.CellValue = customer.Kecamatan != null ? customer.Kecamatan.nama_kecamatan : customer.kecamatan_old.NullToString();
                                break;

                            case 6:
                                e.Style.CellValue = customer.alamat;
                                break;

                            case 7:
                                e.Style.CellValue = customer.kode_pos;
                                break;

                            case 8:
                                e.Style.CellValue = customer.kontak;
                                break;

                            case 9:
                                e.Style.CellValue = customer.telepon;
                                break;

                            case 10:
                                e.Style.CellValue           = customer.diskon;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 11:
                                e.Style.CellValue           = NumberHelper.NumberToString(customer.plafon_piutang);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 12:
                                e.Style.CellValue           = NumberHelper.NumberToString(customer.total_piutang - customer.total_pembayaran_piutang);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 500
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Total"
            });

            GridListControlHelper.InitializeGridListControl <PengeluaranBiaya>(this.gridList, _listOfPengeluaran, gridListProperties);

            if (_listOfPengeluaran.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfPengeluaran.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfPengeluaran.Count)
                        {
                            var pengeluaran = _listOfPengeluaran[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(pengeluaran.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = pengeluaran.nota;
                                break;

                            case 4:
                                e.Style.CellValue = pengeluaran.keterangan;
                                break;

                            case 5:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(pengeluaran.total);
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 23
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota Pembayaran", Width = 120
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Customer", Width = 300
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pembayaran", Width = 150
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan"
            });

            GridListControlHelper.InitializeGridListControl <PembayaranPiutangProduk>(this.gridList, _listOfPembayaranPiutang, gridListProperties);

            if (_listOfPembayaranPiutang.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfPembayaranPiutang.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfPembayaranPiutang.Count)
                        {
                            var pembayaran = _listOfPembayaranPiutang[rowIndex];
                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(pembayaran.tanggal);
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = pembayaran.nota;
                                break;

                            case 4:
                                var customer = pembayaran.Customer;

                                if (customer != null)
                                {
                                    e.Style.CellValue = customer.nama_customer;
                                }

                                break;

                            case 5:
                                var total = pembayaran.item_pembayaran_piutang.Sum(f => f.nominal);

                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(total);

                                break;

                            case 6:
                                e.Style.CellValue = pembayaran.keterangan;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Golongan", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Produk", Width = 130
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nama Produk", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Satuan", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Beli", Width = 70
            });

            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Jual", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Jual", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Jual", Width = 70
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga Jual", Width = 70
            });

            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon", Width = 50
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Stok Etalase", Width = 60
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Stok Gudang", Width = 60
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Min. Stok Gudang"
            });

            GridListControlHelper.InitializeGridListControl <Produk>(this.gridList, _listOfProduk, gridListProperties, false, additionalRowCount: 1);
            this.gridList.Grid.Model.RowHeights[1]    = 25;
            this.gridList.Grid.Model.Rows.FrozenCount = 1;

            this.gridList.Grid.PrepareViewStyleInfo += delegate(object sender, GridPrepareViewStyleInfoEventArgs e)
            {
                var subHeaderHargaJual = new string[] { "Retail", "Grosir 1", "Grosir 2", "Grosir 3" };
                if (e.ColIndex > 6 && e.RowIndex == 1)
                {
                    var colIndex = 7;

                    foreach (var header in subHeaderHargaJual)
                    {
                        if (colIndex == e.ColIndex)
                        {
                            e.Style.Text = header;
                        }

                        colIndex++;
                    }
                }
            };

            if (_listOfProduk.Count > 0)
            {
                this.gridList.SetSelected(1, true);
            }

            // merge cell
            var column = 1; // kolom no

            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 2; // kolom golongan
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 3; // kolom kode
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 4; // kolom nama produk
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 5; // kolom satuan
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 6; // kolom harga beli
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 7; // kolom harga jual
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 0, column + 3));

            column = 11; // kolom diskon
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 12; // kolom stok etalase
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 13; // kolom stok gudang
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            column = 14; // kolom minimal stok
            this.gridList.Grid.CoveredRanges.Add(GridRangeInfo.Cells(0, column, 1, column));

            var headerStyle = this.gridList.Grid.BaseStylesMap["Column Header"].StyleInfo;

            headerStyle.CellType = GridCellTypeName.Header;

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (e.RowIndex == 1)
                {
                    if (e.ColIndex > 6)
                    {
                        e.Style.ModifyStyle(headerStyle, StyleModifyType.ApplyNew);
                    }

                    // we handled it, let the grid know
                    e.Handled = true;
                }

                if (_listOfProduk.Count > 0)
                {
                    if (e.RowIndex > 1)
                    {
                        var rowIndex = e.RowIndex - 2;

                        if (rowIndex < _listOfProduk.Count)
                        {
                            var produk            = _listOfProduk[rowIndex];
                            var listOfHargaGrosir = produk.list_of_harga_grosir;
                            var hargaGrosir       = 0d;

                            switch (e.ColIndex)
                            {
                            case 1:
                                var noUrut = (_pageNumber - 1) * _pageSize + e.RowIndex - 1;
                                e.Style.CellValue           = noUrut;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 2:
                                if (produk.Golongan != null)
                                {
                                    e.Style.CellValue = produk.Golongan.nama_golongan;
                                }

                                break;

                            case 3:
                                e.Style.CellValue = produk.kode_produk;
                                break;

                            case 4:
                                e.Style.CellValue = produk.nama_produk;
                                break;

                            case 5:
                                var satuan = string.Empty;

                                if (produk.satuan.Length > 0)
                                {
                                    satuan = produk.satuan;
                                }

                                e.Style.CellValue = satuan;
                                break;

                            case 6:
                                e.Style.CellValue           = NumberHelper.NumberToString(produk.harga_beli);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 7:     // harga jual ritel
                                e.Style.CellValue           = NumberHelper.NumberToString(produk.harga_jual);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 8:     // harga grosir 1
                                hargaGrosir = listOfHargaGrosir.Count > 0 ? listOfHargaGrosir[0].harga_grosir : 0;

                                e.Style.CellValue           = NumberHelper.NumberToString(hargaGrosir);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 9:     // harga grosir 2
                                hargaGrosir = listOfHargaGrosir.Count > 1 ? listOfHargaGrosir[1].harga_grosir : 0;

                                e.Style.CellValue           = NumberHelper.NumberToString(hargaGrosir);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 10:     // harga grosir 3
                                hargaGrosir = listOfHargaGrosir.Count > 2 ? listOfHargaGrosir[2].harga_grosir : 0;

                                e.Style.CellValue           = NumberHelper.NumberToString(hargaGrosir);
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                break;

                            case 11:
                                e.Style.CellValue           = produk.diskon;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 12:
                                e.Style.CellValue           = produk.stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 13:
                                e.Style.CellValue           = produk.stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 14:
                                e.Style.CellValue           = produk.minimal_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 25
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tempo", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Customer", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 450
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Piutang", Width = 150
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sisa Piutang"
            });

            GridListControlHelper.InitializeGridListControl <JualProduk>(this.gridList, _listOfJual, gridListProperties);

            if (_listOfJual.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfJual.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfJual.Count)
                        {
                            double totalNota = 0;

                            var jual = _listOfJual[rowIndex];
                            if (jual != null)
                            {
                                totalNota = jual.grand_total;
                            }


                            var isRetur = jual.retur_jual_id != null;

                            if (isRetur)
                            {
                                e.Style.BackColor = Color.Red;
                            }

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal);
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(jual.tanggal_tempo);
                                break;

                            case 4:
                                e.Style.CellValue = jual.nota;
                                break;

                            case 5:
                                if (jual.Customer != null)
                                {
                                    e.Style.CellValue = jual.Customer.nama_customer;
                                }

                                break;

                            case 6:
                                e.Style.CellValue = jual.keterangan;
                                break;

                            case 7:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota);
                                break;

                            case 8:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                                e.Style.CellValue           = NumberHelper.NumberToString(totalNota - jual.total_pelunasan);
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 26
0
        private void InitGridControl(GridControl grid)
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kode Produk", Width = 190
            });

            gridListProperties.Add(new GridListControlProperties
            {
                Header = "Nama Produk",
                Width  = _pengaturanUmum.is_tampilkan_keterangan_tambahan_item_jual ? 520 : 720
            }
                                   );

            gridListProperties.Add(new GridListControlProperties
            {
                Header = _pengaturanUmum.keterangan_tambahan_item_jual,
                Width  = _pengaturanUmum.is_tampilkan_keterangan_tambahan_item_jual ? 200 : 0
            }
                                   );

            gridListProperties.Add(new GridListControlProperties {
                Header = "Jumlah", Width = 75
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon", Width = 75
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Harga", Width = 120
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Sub Total"
            });

            GridListControlHelper.InitializeGridListControl <ItemJualProduk>(grid, _listOfItemJual, gridListProperties);

            grid.QueryRowHeight += delegate(object sender, GridRowColSizeEventArgs e)
            {
                e.Size    = 27;
                e.Handled = true;
            };

            grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                // Make sure the cell falls inside the grid
                if (e.RowIndex > 0)
                {
                    if (!(_listOfItemJual.Count > 0))
                    {
                        return;
                    }

                    var itemJual = _listOfItemJual[e.RowIndex - 1];
                    var produk   = itemJual.Produk;

                    if (e.RowIndex % 2 == 0)
                    {
                        e.Style.BackColor = ColorCollection.BACK_COLOR_ALTERNATE;
                    }

                    double hargaBeli = 0;
                    double hargaJual = 0;
                    double jumlah    = 0;

                    var isRetur = itemJual.jumlah_retur > 0;
                    if (isRetur)
                    {
                        e.Style.BackColor = Color.Red;
                        e.Style.Enabled   = false;
                    }

                    e.Style.Font = new GridFontInfo(new Font("Arial", 15f));

                    switch (e.ColIndex)
                    {
                    case 1:     // no urut
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.Enabled             = false;
                        e.Style.CellValue           = e.RowIndex.ToString();
                        break;

                    case 2:
                        if (produk != null)
                        {
                            e.Style.CellValue = produk.kode_produk;
                        }

                        break;

                    case 3:     // nama produk
                        if (produk != null)
                        {
                            e.Style.CellValue = produk.nama_produk;
                        }

                        break;

                    case 4:     // keterangan
                        e.Style.CellValue = itemJual.keterangan;

                        break;

                    case 5:     // jumlah
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellValue           = itemJual.jumlah - itemJual.jumlah_retur;

                        break;

                    case 6:     // diskon
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.CellValue           = itemJual.diskon;

                        break;

                    case 7:     // harga
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;

                        hargaBeli = itemJual.harga_beli;
                        hargaJual = itemJual.harga_jual;

                        if (produk != null)
                        {
                            if (!(hargaBeli > 0))
                            {
                                hargaBeli = produk.harga_beli;
                            }

                            if (!(hargaJual > 0))
                            {
                                jumlah    = itemJual.jumlah - itemJual.jumlah_retur;
                                hargaJual = GetHargaJualFix(produk, jumlah, produk.harga_jual);
                            }
                        }

                        e.Style.CellValue = NumberHelper.NumberToString(hargaJual);

                        break;

                    case 8:     // subtotal
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
                        e.Style.Enabled             = false;

                        jumlah = itemJual.jumlah - itemJual.jumlah_retur;

                        hargaBeli = itemJual.harga_beli;
                        hargaJual = itemJual.harga_setelah_diskon;

                        if (produk != null)
                        {
                            if (!(hargaBeli > 0))
                            {
                                hargaBeli = produk.harga_beli;
                            }

                            if (!(hargaJual > 0))
                            {
                                double diskon       = itemJual.diskon;
                                double diskonRupiah = 0;

                                if (!(diskon > 0))
                                {
                                    if (_customer != null)
                                    {
                                        diskon = _customer.diskon;
                                    }

                                    if (!(diskon > 0))
                                    {
                                        var diskonProduk = GetDiskonJualFix(produk, jumlah, produk.diskon);
                                        diskon = diskonProduk > 0 ? diskonProduk : produk.Golongan.diskon;
                                    }
                                }

                                hargaJual = GetHargaJualFix(produk, jumlah, produk.harga_jual);

                                diskonRupiah = diskon / 100 * hargaJual;
                                hargaJual   -= diskonRupiah;
                            }
                        }

                        e.Style.CellValue = NumberHelper.NumberToString(jumlah * hargaJual);
                        break;

                    default:
                        break;
                    }

                    e.Handled = true; // we handled it, let the grid know
                }
            };

            var colIndex = 2; // kolom nama produk

            grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate);
        }
Ejemplo n.º 27
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Tanggal", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Produk", Width = 250
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Penambahan Stok Etalase", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Penambahan Stok Gudang", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pengurangan Stok Etalase", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pengurangan Stok Gudang", Width = 80
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Alasan Penyesuaian", Width = 350
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan"
            });

            GridListControlHelper.InitializeGridListControl <PenyesuaianStok>(this.gridList, _listOfPenyesuaianStok, gridListProperties, rowHeight: 35);

            if (_listOfPenyesuaianStok.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfPenyesuaianStok.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfPenyesuaianStok.Count)
                        {
                            var penyesuaianStok = _listOfPenyesuaianStok[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = DateTimeHelper.DateToString(penyesuaianStok.tanggal);
                                break;

                            case 3:
                                e.Style.CellValue = penyesuaianStok.Produk.nama_produk;
                                break;

                            case 4:
                                e.Style.CellValue           = penyesuaianStok.penambahan_stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 5:
                                e.Style.CellValue           = penyesuaianStok.penambahan_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 6:
                                e.Style.CellValue           = penyesuaianStok.pengurangan_stok;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 7:
                                e.Style.CellValue           = penyesuaianStok.pengurangan_stok_gudang;
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                break;

                            case 8:
                                e.Style.CellValue = penyesuaianStok.AlasanPenyesuaianStok.alasan;
                                break;

                            case 9:
                                e.Style.CellValue = penyesuaianStok.keterangan;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 28
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Golongan", Width = 700
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keuntungan (%)", Width = 400
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Diskon"
            });

            GridListControlHelper.InitializeGridListControl <Golongan>(this.gridList, _listOfGolongan, gridListProperties);

            if (_listOfGolongan.Count > 0)
            {
                this.gridList.SetSelected(0, true);
            }

            this.gridList.Grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                if (_listOfGolongan.Count > 0)
                {
                    if (e.RowIndex > 0)
                    {
                        var rowIndex = e.RowIndex - 1;

                        if (rowIndex < _listOfGolongan.Count)
                        {
                            var golongan = _listOfGolongan[rowIndex];

                            switch (e.ColIndex)
                            {
                            case 2:
                                e.Style.CellValue = golongan.nama_golongan;
                                break;

                            case 3:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = golongan.persentase_keuntungan;
                                break;

                            case 4:
                                e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                                e.Style.CellValue           = golongan.diskon;
                                break;

                            default:
                                break;
                            }

                            // we handled it, let the grid know
                            e.Handled = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 29
0
        private void InitGridList()
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });

            var listCount = 0;

            switch (this._referensiType)
            {
            case ReferencesType.JenisPengeluaran:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Jenis Biaya"
                });

                GridListControlHelper.InitializeGridListControl <JenisPengeluaran>(this.gridList, _listOfJenisPengeluaran, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridJenisPengeluaran_QueryCellInfo;

                listCount = _listOfJenisPengeluaran.Count;

                break;

            case ReferencesType.Customer:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Customer", Width = 200
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Customer>(this.gridList, _listOfCustomer, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridCustomer_QueryCellInfo;

                listCount = _listOfCustomer.Count;

                break;

            case ReferencesType.Supplier:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Supplier", Width = 200
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Supplier>(this.gridList, _listOfSupplier, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridSupplier_QueryCellInfo;

                listCount = _listOfSupplier.Count;
                break;

            case ReferencesType.Dropshipper:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Dropshipper", Width = 200
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Alamat"
                });

                GridListControlHelper.InitializeGridListControl <Dropshipper>(this.gridList, _listOfDropshipper, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridDropshipper_QueryCellInfo;

                listCount = _listOfDropshipper.Count;
                break;

            case ReferencesType.Produk:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kode Produk", Width = 100
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Nama Produk", Width = 260
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Harga", Width = 70
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Stok", Width = 50
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Golongan"
                });

                GridListControlHelper.InitializeGridListControl <Produk>(this.gridList, _listOfProduk, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridProduk_QueryCellInfo;

                listCount = _listOfProduk.Count;
                break;

            case ReferencesType.KabupatenAsal:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Provinsi", Width = 250
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kota/Kabupaten", Width = 250
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kode Pos"
                });
                GridListControlHelper.InitializeGridListControl <KabupatenAsalRajaOngkir>(this.gridList, _listOfKabupatenAsal, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridKabupatenAsal_QueryCellInfo;

                listCount = _listOfKabupatenAsal.Count;
                break;

            case ReferencesType.KabupatenTujuan:
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Provinsi", Width = 250
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kota/Kabupaten", Width = 250
                });
                gridListProperties.Add(new GridListControlProperties {
                    Header = "Kode Pos"
                });
                GridListControlHelper.InitializeGridListControl <KabupatenTujuanRajaOngkir>(this.gridList, _listOfKabupatenTujuan, gridListProperties);
                this.gridList.Grid.QueryCellInfo += GridKabupatenTujuan_QueryCellInfo;

                listCount = _listOfKabupatenTujuan.Count;
                break;

            default:
                break;
            }

            if (listCount > 0)
            {
                this.gridList.SetSelected(0, true);
            }
        }
Ejemplo n.º 30
0
        private void InitGridControl(GridControl grid)
        {
            var gridListProperties = new List <GridListControlProperties>();

            gridListProperties.Add(new GridListControlProperties {
                Header = "No", Width = 30
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Nota Beli", Width = 100
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Total", Width = 100, IsEditable = false, HorizontalAlignment = GridHorizontalAlignment.Right
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Kekurangan", Width = 100, IsEditable = false, HorizontalAlignment = GridHorizontalAlignment.Right
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Pembayaran", Width = 100, HorizontalAlignment = GridHorizontalAlignment.Right
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Keterangan", Width = 200
            });
            gridListProperties.Add(new GridListControlProperties {
                Header = "Aksi"
            });

            GridListControlHelper.InitializeGridListControl <ItemPembayaranHutangProduk>(grid, _listOfItemPembayaranHutang, gridListProperties);

            grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e)
            {
                if (e.ColIndex == 7)
                {
                    if (grid.RowCount == 1)
                    {
                        MsgHelper.MsgWarning("Minimal 1 nota harus diinputkan !");
                        return;
                    }

                    if (MsgHelper.MsgDelete())
                    {
                        var pembayaranHutang = _listOfItemPembayaranHutang[e.RowIndex - 1];
                        pembayaranHutang.entity_state = EntityState.Deleted;

                        _listOfItemPembayaranHutangDeleted.Add(pembayaranHutang);
                        _listOfItemPembayaranHutang.Remove(pembayaranHutang);

                        grid.RowCount = _listOfItemPembayaranHutang.Count();
                        grid.Refresh();

                        RefreshTotal();
                    }
                }
            };

            grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e)
            {
                // Make sure the cell falls inside the grid
                if (e.RowIndex > 0)
                {
                    if (!(_listOfItemPembayaranHutang.Count > 0))
                    {
                        return;
                    }

                    double grand_total = 0;
                    double sisaNota    = 0;

                    var itemPembayaran = _listOfItemPembayaranHutang[e.RowIndex - 1];
                    var beli           = itemPembayaran.BeliProduk;
                    if (beli != null)
                    {
                        grand_total = beli.grand_total;
                        sisaNota    = beli.sisa_nota;
                    }

                    switch (e.ColIndex)
                    {
                    case 1:     // no urut
                        e.Style.CellValue = e.RowIndex.ToString();
                        break;

                    case 2:     // nota beli
                        if (beli != null)
                        {
                            e.Style.CellValue = beli.nota;
                        }

                        if (beli != null)
                        {
                            if (beli.tanggal_tempo.IsNull())     // nota tunai nominalnya tidak bisa diedit
                            {
                                e.Style.Enabled   = false;
                                e.Style.BackColor = ColorCollection.DEFAULT_FORM_COLOR;
                                base.SetButtonSimpanToFalse(true);
                            }
                        }

                        break;

                    case 3:     // total
                        e.Style.CellValue = NumberHelper.NumberToString(grand_total);

                        break;

                    case 4:     // kekurangan
                        e.Style.CellValue = NumberHelper.NumberToString(sisaNota);

                        break;

                    case 5:     // pembayaran
                        if (beli != null)
                        {
                            if (beli.tanggal_tempo.IsNull())     // nota tunai nominalnya tidak bisa diedit
                            {
                                e.Style.Enabled   = false;
                                e.Style.BackColor = ColorCollection.DEFAULT_FORM_COLOR;
                            }
                        }

                        e.Style.CellValue = NumberHelper.NumberToString(itemPembayaran.nominal);

                        break;

                    case 6:     // keterangan
                        e.Style.CellValue = itemPembayaran.keterangan;

                        break;

                    case 7:     // button hapus
                        e.Style.CellType            = GridCellTypeName.PushButton;
                        e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
                        e.Style.Description         = "Hapus";

                        if (beli != null)
                        {
                            e.Style.Enabled = !beli.tanggal_tempo.IsNull();
                        }

                        break;

                    default:
                        break;
                    }

                    e.Handled = true; // we handled it, let the grid know
                }
            };

            var colIndex = 2; // kolom nama produk

            grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate);
        }